@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,74 +0,0 @@
|
|
|
1
|
-
import { useEditContext } from "../client/editContext";
|
|
2
|
-
import { classNames } from "primereact/utils";
|
|
3
|
-
|
|
4
|
-
export function NavButtons() {
|
|
5
|
-
const editContext = useEditContext();
|
|
6
|
-
if (!editContext) return;
|
|
7
|
-
|
|
8
|
-
const item = editContext.contentEditorItem;
|
|
9
|
-
if (!item) return;
|
|
10
|
-
|
|
11
|
-
const history = editContext.browseHistory;
|
|
12
|
-
|
|
13
|
-
const currentIndex = history.findIndex(
|
|
14
|
-
(x) => x.id === item.id && x.language === item.language
|
|
15
|
-
);
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
<div
|
|
19
|
-
key="nav-fwd"
|
|
20
|
-
className={classNames(
|
|
21
|
-
currentIndex < history.length - 1
|
|
22
|
-
? " text-gray-200"
|
|
23
|
-
: "text-gray-400",
|
|
24
|
-
"cursor-pointer hover:bg-gray-500 flex gap-2 p-2 rounded-md "
|
|
25
|
-
)}
|
|
26
|
-
onClick={() => {
|
|
27
|
-
const currentIndex = history.findIndex(
|
|
28
|
-
(x) => x.id === item.id && x.language === item.language
|
|
29
|
-
);
|
|
30
|
-
if (currentIndex < history.length - 1) {
|
|
31
|
-
const historyItem = history[currentIndex + 1];
|
|
32
|
-
if (!historyItem) return;
|
|
33
|
-
editContext.loadItem(
|
|
34
|
-
{
|
|
35
|
-
id: historyItem.id,
|
|
36
|
-
language: historyItem.language,
|
|
37
|
-
version: historyItem.version || 0,
|
|
38
|
-
},
|
|
39
|
-
{ addToBrowseHistory: false }
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
<i className="pi pi-chevron-left text-sm" />
|
|
45
|
-
</div>
|
|
46
|
-
<div
|
|
47
|
-
key="nav-back"
|
|
48
|
-
className={classNames(
|
|
49
|
-
currentIndex > 0 ? " text-gray-200" : "text-gray-400",
|
|
50
|
-
"cursor-pointer hover:bg-gray-500 flex gap-2 p-2 rounded-md "
|
|
51
|
-
)}
|
|
52
|
-
onClick={() => {
|
|
53
|
-
const currentIndex = history.findIndex(
|
|
54
|
-
(x) => x.id === item.id && x.language === item.language
|
|
55
|
-
);
|
|
56
|
-
if (currentIndex > 0) {
|
|
57
|
-
const historyItem = history[currentIndex - 1];
|
|
58
|
-
if (!historyItem) return;
|
|
59
|
-
editContext.loadItem(
|
|
60
|
-
{
|
|
61
|
-
id: historyItem.id,
|
|
62
|
-
language: historyItem.language,
|
|
63
|
-
version: historyItem.version || 0,
|
|
64
|
-
},
|
|
65
|
-
{ addToBrowseHistory: false }
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
}}
|
|
69
|
-
>
|
|
70
|
-
<i className="pi pi-chevron-right text-sm" />
|
|
71
|
-
</div>
|
|
72
|
-
</>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from "react";
|
|
2
|
-
import { OverlayPanel } from "primereact/overlaypanel";
|
|
3
|
-
import { useEditContext } from "../client/editContext";
|
|
4
|
-
import { BrowseHistory } from "./BrowseHistory";
|
|
5
|
-
import { ArrowDownIcon } from "../ui/Icons";
|
|
6
|
-
|
|
7
|
-
import { Button } from "primereact/button";
|
|
8
|
-
import { FullItem, ItemDescriptor } from "../pageModel";
|
|
9
|
-
|
|
10
|
-
import { ResultItem, ItemSearch } from "../ui/ItemSearch";
|
|
11
|
-
import { ScrollingContentTree } from "../ScrollingContentTree";
|
|
12
|
-
import { ItemTreeNodeData } from "../services/contentService";
|
|
13
|
-
import { SimpleTabs, Tab } from "../ui/SimpleTabs";
|
|
14
|
-
|
|
15
|
-
export function PageSelector({
|
|
16
|
-
itemDescriptor,
|
|
17
|
-
}: {
|
|
18
|
-
itemDescriptor: ItemDescriptor;
|
|
19
|
-
}) {
|
|
20
|
-
const overlaypanel = useRef<OverlayPanel>(null);
|
|
21
|
-
const editContext = useEditContext();
|
|
22
|
-
const [item, setItem] = useState<FullItem | undefined>();
|
|
23
|
-
const [activeTab, setActiveTab] = useState(0);
|
|
24
|
-
|
|
25
|
-
const [hoveredItem, setHoveredItem] = useState<ResultItem | undefined>();
|
|
26
|
-
|
|
27
|
-
const loadItem = (selectedItem: ItemTreeNodeData[] | ItemDescriptor) => {
|
|
28
|
-
if (Array.isArray(selectedItem) && selectedItem[0]) {
|
|
29
|
-
selectedItem = selectedItem[0];
|
|
30
|
-
}
|
|
31
|
-
if (!selectedItem) return;
|
|
32
|
-
const itemDescriptor = selectedItem as ItemDescriptor;
|
|
33
|
-
editContext?.loadItem({
|
|
34
|
-
id: itemDescriptor.id,
|
|
35
|
-
language: itemDescriptor.language,
|
|
36
|
-
version: 0,
|
|
37
|
-
});
|
|
38
|
-
overlaypanel.current?.hide();
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
const setName = async () => {
|
|
43
|
-
if (!itemDescriptor) return;
|
|
44
|
-
const item = await editContext?.itemsRepository.getItem(itemDescriptor);
|
|
45
|
-
setItem(item);
|
|
46
|
-
};
|
|
47
|
-
setName();
|
|
48
|
-
}, [itemDescriptor]);
|
|
49
|
-
|
|
50
|
-
if (!editContext) return null;
|
|
51
|
-
|
|
52
|
-
const tabs: Tab[] = [
|
|
53
|
-
{
|
|
54
|
-
id: "browse",
|
|
55
|
-
label: "Browse",
|
|
56
|
-
testId: "browse-tab",
|
|
57
|
-
content: (
|
|
58
|
-
<div className="relative flex-1">
|
|
59
|
-
<div className="absolute inset-0 overflow-auto">
|
|
60
|
-
<ScrollingContentTree
|
|
61
|
-
selectedItemId={hoveredItem?.id ?? item?.id}
|
|
62
|
-
onSelectionChange={loadItem}
|
|
63
|
-
/>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
),
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: "search",
|
|
70
|
-
label: "Search",
|
|
71
|
-
testId: "search-tab",
|
|
72
|
-
content: (
|
|
73
|
-
<div className="p-2">
|
|
74
|
-
<ItemSearch
|
|
75
|
-
autoFocus={true}
|
|
76
|
-
setHoveredItem={setHoveredItem}
|
|
77
|
-
itemSelected={(item) => loadItem(item)}
|
|
78
|
-
/>
|
|
79
|
-
</div>
|
|
80
|
-
),
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
id: "history",
|
|
84
|
-
label: "Recent",
|
|
85
|
-
testId: "history-tab",
|
|
86
|
-
content: (
|
|
87
|
-
<div className="relative flex-1">
|
|
88
|
-
<div className="absolute inset-0 overflow-auto">
|
|
89
|
-
<BrowseHistory
|
|
90
|
-
setHoveredItem={setHoveredItem}
|
|
91
|
-
itemSelected={(item) => loadItem(item)}
|
|
92
|
-
/>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
),
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
id: "actions",
|
|
99
|
-
label: "Actions",
|
|
100
|
-
testId: "actions-tab",
|
|
101
|
-
content: (
|
|
102
|
-
<div className="p-2">
|
|
103
|
-
<div className="flex gap-2">
|
|
104
|
-
<Button
|
|
105
|
-
size="small"
|
|
106
|
-
icon="pi pi-plus"
|
|
107
|
-
label="New Page"
|
|
108
|
-
onClick={() => editContext?.openCreatePageDialog()}
|
|
109
|
-
></Button>
|
|
110
|
-
<Button
|
|
111
|
-
id="delete-page-button"
|
|
112
|
-
severity="danger"
|
|
113
|
-
size="small"
|
|
114
|
-
icon="pi pi-times"
|
|
115
|
-
label="Delete"
|
|
116
|
-
onClick={async (ev) => {
|
|
117
|
-
if (
|
|
118
|
-
item &&
|
|
119
|
-
(await editContext?.executeCommand({
|
|
120
|
-
command: editContext?.configuration.commands.deleteItem,
|
|
121
|
-
event: ev,
|
|
122
|
-
data: { items: [item] },
|
|
123
|
-
}))
|
|
124
|
-
)
|
|
125
|
-
editContext?.openSplashScreen();
|
|
126
|
-
}}
|
|
127
|
-
></Button>
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
130
|
-
),
|
|
131
|
-
},
|
|
132
|
-
];
|
|
133
|
-
|
|
134
|
-
return (
|
|
135
|
-
<>
|
|
136
|
-
<div
|
|
137
|
-
id="page-selector-button"
|
|
138
|
-
className="flex cursor-pointer items-center gap-3 rounded-md p-[7px] py-[5px] text-sm text-gray-200 hover:bg-gray-500"
|
|
139
|
-
onClick={(ev) => overlaypanel.current?.toggle(ev, ev.currentTarget)}
|
|
140
|
-
data-testid="page-selector-button"
|
|
141
|
-
>
|
|
142
|
-
{item?.name || "unknown"}
|
|
143
|
-
<div
|
|
144
|
-
className="p-dropdown-trigger"
|
|
145
|
-
role="button"
|
|
146
|
-
aria-haspopup="listbox"
|
|
147
|
-
aria-expanded="false"
|
|
148
|
-
aria-label="Select a page"
|
|
149
|
-
data-pc-section="trigger"
|
|
150
|
-
>
|
|
151
|
-
<ArrowDownIcon />
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
<OverlayPanel dismissable={true} ref={overlaypanel} closeOnEscape>
|
|
155
|
-
<div className="flex h-[75vh] min-w-96 flex-col overflow-hidden">
|
|
156
|
-
<SimpleTabs
|
|
157
|
-
tabs={tabs}
|
|
158
|
-
activeTab={activeTab}
|
|
159
|
-
setActiveTab={setActiveTab}
|
|
160
|
-
className="px-2 pt-2 text-sm"
|
|
161
|
-
/>
|
|
162
|
-
</div>
|
|
163
|
-
</OverlayPanel>
|
|
164
|
-
</>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { classNames } from "primereact/utils";
|
|
2
|
-
import { useEditContext } from "../client/editContext";
|
|
3
|
-
import { Separator } from "./Separator";
|
|
4
|
-
import { CompareIcon, FormEditIcon } from "../ui/Icons";
|
|
5
|
-
import { SimpleIconButton } from "../ui/SimpleIconButton";
|
|
6
|
-
import { Route, SquarePen, UserRoundPen, EyeIcon, Pencil } from "lucide-react";
|
|
7
|
-
|
|
8
|
-
export function PageViewerControls() {
|
|
9
|
-
const editContext = useEditContext();
|
|
10
|
-
|
|
11
|
-
if (!editContext) return null;
|
|
12
|
-
|
|
13
|
-
const hasLayout = editContext.contentEditorItem?.hasLayout;
|
|
14
|
-
|
|
15
|
-
const pageViewContext = editContext.pageView;
|
|
16
|
-
|
|
17
|
-
const device = pageViewContext.device;
|
|
18
|
-
const setDevice = pageViewContext.setDevice;
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div className="flex items-center gap-2">
|
|
22
|
-
{hasLayout && (
|
|
23
|
-
<>
|
|
24
|
-
{!editContext.user?.isLimitedPreviewUser && (
|
|
25
|
-
<SimpleIconButton
|
|
26
|
-
icon={<Pencil className="h-6 w-6 p-1" />}
|
|
27
|
-
label="Edit"
|
|
28
|
-
dark={true}
|
|
29
|
-
size="large"
|
|
30
|
-
selected={editContext.mode === "edit"}
|
|
31
|
-
onClick={() => editContext.setMode("edit")}
|
|
32
|
-
/>
|
|
33
|
-
)}
|
|
34
|
-
|
|
35
|
-
<SimpleIconButton
|
|
36
|
-
icon={<EyeIcon className="h-6 w-6 p-1" />}
|
|
37
|
-
label="Preview"
|
|
38
|
-
dark={true}
|
|
39
|
-
size="large"
|
|
40
|
-
selected={editContext.mode === "preview"}
|
|
41
|
-
onClick={() => editContext.setMode("preview")}
|
|
42
|
-
/>
|
|
43
|
-
|
|
44
|
-
<SimpleIconButton
|
|
45
|
-
selected={editContext?.mode === "suggestions"}
|
|
46
|
-
icon={<UserRoundPen size={24} className="p-0.5" />}
|
|
47
|
-
label="Write suggestions"
|
|
48
|
-
dark={true}
|
|
49
|
-
size="large"
|
|
50
|
-
onClick={() => editContext?.setMode("suggestions")}
|
|
51
|
-
/>
|
|
52
|
-
<Separator size="large" />
|
|
53
|
-
{!editContext.isMobile && (
|
|
54
|
-
<>
|
|
55
|
-
<i
|
|
56
|
-
className={classNames(
|
|
57
|
-
device === "desktop"
|
|
58
|
-
? "bg-gray-200"
|
|
59
|
-
: "text-gray-400 hover:bg-gray-200 hover:text-gray-800",
|
|
60
|
-
"pi pi-desktop cursor-pointer rounded-full p-2",
|
|
61
|
-
)}
|
|
62
|
-
title="Desktop"
|
|
63
|
-
onClick={() => {
|
|
64
|
-
setDevice("desktop");
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
<i
|
|
68
|
-
className={classNames(
|
|
69
|
-
device && device !== "desktop"
|
|
70
|
-
? "bg-gray-200"
|
|
71
|
-
: "text-gray-400 hover:bg-gray-200 hover:text-gray-800",
|
|
72
|
-
"pi pi-mobile cursor-pointer rounded-full p-2",
|
|
73
|
-
)}
|
|
74
|
-
title="Mobile"
|
|
75
|
-
onClick={() => {
|
|
76
|
-
if (editContext.configuration.devices[0]) {
|
|
77
|
-
setDevice(editContext.configuration.devices[0].name);
|
|
78
|
-
}
|
|
79
|
-
}}
|
|
80
|
-
/>
|
|
81
|
-
<i
|
|
82
|
-
className={classNames(
|
|
83
|
-
!device
|
|
84
|
-
? "bg-gray-200"
|
|
85
|
-
: "text-gray-400 hover:bg-gray-200 hover:text-gray-800",
|
|
86
|
-
"h-8 w-8 cursor-pointer rounded-full p-1",
|
|
87
|
-
)}
|
|
88
|
-
title="Form"
|
|
89
|
-
onClick={() => {
|
|
90
|
-
setDevice("");
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
<FormEditIcon />
|
|
94
|
-
</i>
|
|
95
|
-
<Separator size="large" />
|
|
96
|
-
</>
|
|
97
|
-
)}
|
|
98
|
-
<i
|
|
99
|
-
className="pi pi-external-link cursor-pointer rounded-full p-2 text-gray-400 hover:bg-gray-200 hover:text-gray-800"
|
|
100
|
-
title="Fullscreen"
|
|
101
|
-
onClick={() => pageViewContext.setFullscreen(true)}
|
|
102
|
-
/>
|
|
103
|
-
</>
|
|
104
|
-
)}
|
|
105
|
-
{!editContext.isMobile && (
|
|
106
|
-
<SimpleIconButton
|
|
107
|
-
icon={<CompareIcon className="h-6 w-6 p-1" />}
|
|
108
|
-
label="Compare"
|
|
109
|
-
size="large"
|
|
110
|
-
dark={true}
|
|
111
|
-
className={
|
|
112
|
-
editContext.compareMode ? "text-gray-600" : "hover:text-gray-600"
|
|
113
|
-
}
|
|
114
|
-
selected={editContext.compareMode}
|
|
115
|
-
onClick={() => editContext.setCompareMode(!editContext.compareMode)}
|
|
116
|
-
/>
|
|
117
|
-
)}
|
|
118
|
-
</div>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useEditContext } from "../client/editContext";
|
|
2
|
-
import { PreviewInfo } from "../reviews/PreviewInfo";
|
|
3
|
-
import { ActionsMenu } from "./ActionsMenu";
|
|
4
|
-
|
|
5
|
-
export const PreviewSecondaryControls = () => {
|
|
6
|
-
const editContext = useEditContext();
|
|
7
|
-
if (!editContext) return null;
|
|
8
|
-
return (
|
|
9
|
-
<div
|
|
10
|
-
className={`flex items-center gap-3 ${
|
|
11
|
-
editContext.isMobile ? "flex-col" : ""
|
|
12
|
-
}`}
|
|
13
|
-
>
|
|
14
|
-
<PreviewInfo />
|
|
15
|
-
<ActionsMenu isMobile={editContext.isMobile} />
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useEditContext } from "../client/editContext";
|
|
2
|
-
import { ItemLanguageVersion } from "./ItemLanguageVersion";
|
|
3
|
-
import { ActiveUsers } from "./ActiveUsers";
|
|
4
|
-
import { ActionsMenu } from "./ActionsMenu";
|
|
5
|
-
import { Separator } from "../menubar/Separator";
|
|
6
|
-
|
|
7
|
-
export function SecondaryControls() {
|
|
8
|
-
const editContext = useEditContext();
|
|
9
|
-
|
|
10
|
-
if (editContext?.isMobile) {
|
|
11
|
-
return (
|
|
12
|
-
<div className="flex flex-col items-end gap-4">
|
|
13
|
-
<div className="flex flex-col gap-2">
|
|
14
|
-
<Headline title="Current Page" />
|
|
15
|
-
<ItemLanguageVersion />
|
|
16
|
-
</div>
|
|
17
|
-
<div className="flex flex-col gap-2">
|
|
18
|
-
<Headline title="Active Users" />
|
|
19
|
-
<ActiveUsers />
|
|
20
|
-
</div>
|
|
21
|
-
<div className="flex flex-col gap-2">
|
|
22
|
-
<Headline title="Actions" />
|
|
23
|
-
<ActionsMenu isMobile={true} />
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<div className="flex items-center gap-2">
|
|
31
|
-
<ItemLanguageVersion />
|
|
32
|
-
<Separator size="large" />
|
|
33
|
-
<ActiveUsers />
|
|
34
|
-
<ActionsMenu isMobile={false} />
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function Headline({ title }: { title: string }) {
|
|
40
|
-
return (
|
|
41
|
-
<div className="flex flex-col items-end gap-2">
|
|
42
|
-
<div className="text-sm font-bold text-gray-300">{title}</div>
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { classNames } from "primereact/utils";
|
|
2
|
-
|
|
3
|
-
export function Separator({ size }: { size?: "large" | "small" }) {
|
|
4
|
-
return (
|
|
5
|
-
<div
|
|
6
|
-
className={classNames(
|
|
7
|
-
"border-r border-gray-400",
|
|
8
|
-
size === "large" ? "mx-3 h-7" : "mx-1 h-4",
|
|
9
|
-
)}
|
|
10
|
-
></div>
|
|
11
|
-
);
|
|
12
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { OverlayPanel } from "primereact/overlaypanel";
|
|
2
|
-
import { useEditContext } from "../client/editContext";
|
|
3
|
-
import { useRef, useState } from "react";
|
|
4
|
-
import { getSites } from "../services/contentService";
|
|
5
|
-
import { Site } from "../../types";
|
|
6
|
-
import { ProgressSpinner } from "primereact/progressspinner";
|
|
7
|
-
|
|
8
|
-
export function SiteInfo() {
|
|
9
|
-
const editContext = useEditContext();
|
|
10
|
-
const overlaypanel = useRef<OverlayPanel>(null);
|
|
11
|
-
const [sites, setSites] = useState<Site[]>();
|
|
12
|
-
if (!editContext) return null;
|
|
13
|
-
|
|
14
|
-
const loadSites = async () => {
|
|
15
|
-
const sites = await getSites();
|
|
16
|
-
if (sites.data) setSites(sites.data);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div
|
|
21
|
-
className="my-2 flex gap-2 items-center text-gray-200 cursor-pointer"
|
|
22
|
-
title={editContext.pageView.site?.name}
|
|
23
|
-
onClick={async (ev) => {
|
|
24
|
-
setSites(undefined);
|
|
25
|
-
overlaypanel.current!.toggle(ev);
|
|
26
|
-
await loadSites();
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
<i className="pi pi-globe text-lg" />
|
|
30
|
-
<OverlayPanel dismissable={true} ref={overlaypanel} closeOnEscape>
|
|
31
|
-
<div className="max-h-[45vh] min-w-20 flex flex-col overflow-hidden text-xs">
|
|
32
|
-
<div className="p-4">
|
|
33
|
-
This page is part of the site:{" "}
|
|
34
|
-
<span className="font-bold">
|
|
35
|
-
{editContext.pageView.site?.name}
|
|
36
|
-
</span>
|
|
37
|
-
{!sites && <ProgressSpinner className="w-5 h-5" />}
|
|
38
|
-
{sites && (
|
|
39
|
-
<div>
|
|
40
|
-
<div className="border-b my-2">Sites registered:</div>
|
|
41
|
-
<ul>
|
|
42
|
-
{sites.map((site) => (
|
|
43
|
-
<li key={site.name}>{site.name}</li>
|
|
44
|
-
))}
|
|
45
|
-
</ul>
|
|
46
|
-
</div>
|
|
47
|
-
)}
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</OverlayPanel>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { EditSession } from "../../types";
|
|
2
|
-
import { useEditContext } from "../client/editContext";
|
|
3
|
-
|
|
4
|
-
export function User({ session }: { session: EditSession }) {
|
|
5
|
-
const editContext = useEditContext();
|
|
6
|
-
if (!editContext) return;
|
|
7
|
-
|
|
8
|
-
const userName = session.user.displayName || session.user.name;
|
|
9
|
-
|
|
10
|
-
const idxBackslash = userName.indexOf("\\");
|
|
11
|
-
const letter =
|
|
12
|
-
idxBackslash >= 0
|
|
13
|
-
? userName[idxBackslash + 1]
|
|
14
|
-
: userName[0]
|
|
15
|
-
? userName[0].toUpperCase()
|
|
16
|
-
: "";
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div
|
|
20
|
-
className="rounded-full w-8 h-8 grid items-center justify-center text-white"
|
|
21
|
-
style={{ background: session.color }}
|
|
22
|
-
title={userName + " (" + session.user.email + ")"}
|
|
23
|
-
>
|
|
24
|
-
{letter}
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { ArrowDownIcon } from "../ui/Icons";
|
|
4
|
-
import { useRef } from "react";
|
|
5
|
-
import { OverlayPanel } from "primereact/overlaypanel";
|
|
6
|
-
import { Button } from "primereact/button";
|
|
7
|
-
import { useEditContext } from "../client/editContext";
|
|
8
|
-
import { getCreateAndSwitchToNewVersionCommand } from "../commands/createVersionCommand";
|
|
9
|
-
import { getDeleteVersionCommand } from "../commands/deleteVersionCommand";
|
|
10
|
-
import { ItemDescriptor, Version } from "../pageModel";
|
|
11
|
-
|
|
12
|
-
export function VersionSelector({
|
|
13
|
-
itemDescriptor,
|
|
14
|
-
actualVersion,
|
|
15
|
-
onVersionSelected,
|
|
16
|
-
readOnly,
|
|
17
|
-
darkMode,
|
|
18
|
-
versions,
|
|
19
|
-
}: {
|
|
20
|
-
itemDescriptor: ItemDescriptor | undefined;
|
|
21
|
-
actualVersion: number | undefined;
|
|
22
|
-
onVersionSelected: (version: number) => void;
|
|
23
|
-
readOnly?: boolean;
|
|
24
|
-
darkMode?: boolean;
|
|
25
|
-
versions: Version[];
|
|
26
|
-
}) {
|
|
27
|
-
const editContext = useEditContext();
|
|
28
|
-
const overlaypanel = useRef<OverlayPanel>(null);
|
|
29
|
-
|
|
30
|
-
if (itemDescriptor == null) return;
|
|
31
|
-
|
|
32
|
-
const getVersionLabel = () => {
|
|
33
|
-
if (versions.length === 0) return "No versions";
|
|
34
|
-
if (itemDescriptor.version === 0)
|
|
35
|
-
return "Latest" + (actualVersion ? " (" + actualVersion + ")" : "");
|
|
36
|
-
return itemDescriptor.version;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<>
|
|
41
|
-
<div
|
|
42
|
-
data-testid="version-selector"
|
|
43
|
-
className={`flex cursor-pointer items-center gap-3 p-[7px] py-[5px] text-sm ${
|
|
44
|
-
darkMode
|
|
45
|
-
? "text-gray-500 hover:bg-gray-200"
|
|
46
|
-
: "text-gray-200 hover:bg-gray-500"
|
|
47
|
-
} a rounded-md`}
|
|
48
|
-
onClick={(ev) => overlaypanel.current?.toggle(ev, ev.currentTarget)}
|
|
49
|
-
>
|
|
50
|
-
<div className="flex gap-2">{getVersionLabel()}</div>
|
|
51
|
-
<div
|
|
52
|
-
className={`p-dropdown-trigger ${
|
|
53
|
-
darkMode ? "text-gray-500" : "text-gray-200"
|
|
54
|
-
}`}
|
|
55
|
-
role="button"
|
|
56
|
-
aria-haspopup="listbox"
|
|
57
|
-
aria-expanded="false"
|
|
58
|
-
aria-label="Select a version"
|
|
59
|
-
data-pc-section="trigger"
|
|
60
|
-
>
|
|
61
|
-
<ArrowDownIcon />
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
<OverlayPanel dismissable={true} ref={overlaypanel} closeOnEscape>
|
|
65
|
-
<div className="flex max-h-[50vh] min-w-20 flex-col">
|
|
66
|
-
<div className="flex-1 overflow-auto">
|
|
67
|
-
<div className="flex flex-col text-sm">
|
|
68
|
-
{versions.length === 0 && <div className="p-2">No versions</div>}
|
|
69
|
-
{versions.length > 0 && (
|
|
70
|
-
<div
|
|
71
|
-
key="latest"
|
|
72
|
-
className="flex cursor-pointer gap-2 p-2 hover:bg-gray-200"
|
|
73
|
-
onClick={() => {
|
|
74
|
-
onVersionSelected(0);
|
|
75
|
-
overlaypanel.current?.hide();
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
78
|
-
Latest
|
|
79
|
-
</div>
|
|
80
|
-
)}
|
|
81
|
-
{versions.map((x) => (
|
|
82
|
-
<div
|
|
83
|
-
key={x.version}
|
|
84
|
-
className="flex cursor-pointer gap-2 p-2 hover:bg-gray-200"
|
|
85
|
-
onClick={() => {
|
|
86
|
-
onVersionSelected(x.version);
|
|
87
|
-
overlaypanel.current?.hide();
|
|
88
|
-
}}
|
|
89
|
-
>
|
|
90
|
-
{itemDescriptor.version === x.version && (
|
|
91
|
-
<i className="pi pi-check" style={{ fontSize: "1rem" }}></i>
|
|
92
|
-
)}{" "}
|
|
93
|
-
{x.version}
|
|
94
|
-
</div>
|
|
95
|
-
))}
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
{!readOnly && (
|
|
100
|
-
<div className="flex flex-col border-t p-2">
|
|
101
|
-
<div className="mb-2 flex items-center gap-1 text-xs text-gray-500">
|
|
102
|
-
<ArrowDownIcon /> Actions
|
|
103
|
-
</div>
|
|
104
|
-
<div className="flex gap-2">
|
|
105
|
-
<Button
|
|
106
|
-
text
|
|
107
|
-
size="small"
|
|
108
|
-
icon="pi pi-plus"
|
|
109
|
-
label="Add Version"
|
|
110
|
-
onClick={async (ev) => {
|
|
111
|
-
await editContext?.executeCommand({
|
|
112
|
-
command: getCreateAndSwitchToNewVersionCommand({}),
|
|
113
|
-
event: ev,
|
|
114
|
-
});
|
|
115
|
-
overlaypanel.current?.hide();
|
|
116
|
-
onVersionSelected(0);
|
|
117
|
-
}}
|
|
118
|
-
/>
|
|
119
|
-
<Button
|
|
120
|
-
text
|
|
121
|
-
size="small"
|
|
122
|
-
icon="pi pi-times"
|
|
123
|
-
label="Delete Version"
|
|
124
|
-
severity="danger"
|
|
125
|
-
disabled={versions.length === 0}
|
|
126
|
-
onClick={async (ev) => {
|
|
127
|
-
editContext;
|
|
128
|
-
await editContext?.executeCommand({
|
|
129
|
-
command: getDeleteVersionCommand({}),
|
|
130
|
-
event: ev,
|
|
131
|
-
});
|
|
132
|
-
overlaypanel.current?.hide();
|
|
133
|
-
onVersionSelected(0);
|
|
134
|
-
}}
|
|
135
|
-
/>{" "}
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
)}
|
|
139
|
-
</OverlayPanel>
|
|
140
|
-
</>
|
|
141
|
-
);
|
|
142
|
-
}
|