@alpaca-editor/core 1.0.3955 → 1.0.3959
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 +1 -1
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +23 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.js +3 -3
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/command.js +35 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +15 -0
- package/dist/components/ui/dialog.js +37 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/dropdown-menu.js +52 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +7 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/menubar.d.ts +26 -0
- package/dist/components/ui/menubar.js +55 -0
- package/dist/components/ui/menubar.js.map +1 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.js +63 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +9 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +18 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/config/config.js +79 -63
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +3 -3
- package/dist/editor/ContentTree.js +1 -1
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/Editor.js +6 -2
- package/dist/editor/Editor.js.map +1 -1
- package/dist/editor/FieldList.js +1 -1
- package/dist/editor/FieldList.js.map +1 -1
- package/dist/editor/FieldListField.js +1 -1
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/ImageEditor.js +16 -6
- package/dist/editor/ImageEditor.js.map +1 -1
- package/dist/editor/MainLayout.js +4 -4
- package/dist/editor/MainLayout.js.map +1 -1
- package/dist/editor/MobileLayout.js +3 -3
- package/dist/editor/MobileLayout.js.map +1 -1
- package/dist/editor/PictureEditor.js +29 -15
- package/dist/editor/PictureEditor.js.map +1 -1
- package/dist/editor/Titlebar.js +6 -11
- package/dist/editor/Titlebar.js.map +1 -1
- package/dist/editor/ai/GhostWriter.js +1 -1
- package/dist/editor/ai/GhostWriter.js.map +1 -1
- package/dist/editor/client/EditorClient.d.ts +4 -2
- package/dist/editor/client/EditorClient.js +32 -11
- package/dist/editor/client/EditorClient.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +4 -1
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/operations.js +2 -2
- package/dist/editor/client/pageModelBuilder.js +3 -6
- package/dist/editor/client/pageModelBuilder.js.map +1 -1
- package/dist/editor/commands/itemCommands.d.ts +2 -0
- package/dist/editor/commands/itemCommands.js +180 -0
- package/dist/editor/commands/itemCommands.js.map +1 -1
- package/dist/editor/field-types/MultiLineText.js +1 -1
- package/dist/editor/field-types/MultiLineText.js.map +1 -1
- package/dist/editor/field-types/SingleLineText.js +1 -1
- package/dist/editor/field-types/SingleLineText.js.map +1 -1
- package/dist/editor/menubar/ActiveUsers.js +98 -4
- package/dist/editor/menubar/ActiveUsers.js.map +1 -1
- package/dist/editor/menubar/{ActionsMenu.d.ts → ItemActionsMenu.d.ts} +1 -1
- package/dist/editor/menubar/ItemActionsMenu.js +23 -0
- package/dist/editor/menubar/ItemActionsMenu.js.map +1 -0
- package/dist/editor/menubar/ItemLanguageVersion.js +2 -2
- package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -1
- package/dist/editor/menubar/LanguageSelector.d.ts +1 -2
- package/dist/editor/menubar/LanguageSelector.js +23 -23
- package/dist/editor/menubar/LanguageSelector.js.map +1 -1
- package/dist/editor/menubar/PageSelector.js +7 -8
- package/dist/editor/menubar/PageSelector.js.map +1 -1
- package/dist/editor/menubar/PageViewerControls.js +22 -19
- package/dist/editor/menubar/PageViewerControls.js.map +1 -1
- package/dist/editor/menubar/PreviewSecondaryControls.js +2 -3
- package/dist/editor/menubar/PreviewSecondaryControls.js.map +1 -1
- package/dist/editor/menubar/User.js +1 -1
- package/dist/editor/menubar/User.js.map +1 -1
- package/dist/editor/menubar/VersionSelector.js +36 -31
- package/dist/editor/menubar/VersionSelector.js.map +1 -1
- package/dist/editor/menubar/WorkflowButton.d.ts +1 -0
- package/dist/editor/menubar/WorkflowButton.js +41 -0
- package/dist/editor/menubar/WorkflowButton.js.map +1 -0
- package/dist/editor/page-editor-chrome/FrameMenu.js +5 -5
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/SuggestionHighlightings.js +2 -2
- package/dist/editor/page-editor-chrome/SuggestionHighlightings.js.map +1 -1
- package/dist/editor/page-viewer/EditorForm.d.ts +2 -1
- package/dist/editor/page-viewer/EditorForm.js +61 -49
- package/dist/editor/page-viewer/EditorForm.js.map +1 -1
- package/dist/editor/page-viewer/PageViewer.d.ts +2 -1
- package/dist/editor/page-viewer/PageViewer.js +28 -44
- package/dist/editor/page-viewer/PageViewer.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/reviews/Comments.js +9 -9
- package/dist/editor/reviews/Comments.js.map +1 -1
- package/dist/editor/reviews/SuggestedEdit.js +3 -3
- package/dist/editor/services/contentService.d.ts +18 -0
- package/dist/editor/services/contentService.js +6 -0
- package/dist/editor/services/contentService.js.map +1 -1
- package/dist/editor/services/editService.d.ts +5 -0
- package/dist/editor/services/editService.js +4 -0
- package/dist/editor/services/editService.js.map +1 -1
- package/dist/editor/services/systemService.d.ts +2 -1
- package/dist/editor/services/systemService.js +4 -1
- package/dist/editor/services/systemService.js.map +1 -1
- package/dist/editor/sidebar/ComponentTree.js +26 -10
- package/dist/editor/sidebar/ComponentTree.js.map +1 -1
- package/dist/editor/sidebar/Divider.d.ts +6 -0
- package/dist/editor/sidebar/Divider.js +6 -0
- package/dist/editor/sidebar/Divider.js.map +1 -0
- package/dist/editor/sidebar/LeftToolbar.d.ts +1 -0
- package/dist/editor/sidebar/LeftToolbar.js +16 -0
- package/dist/editor/sidebar/LeftToolbar.js.map +1 -0
- package/dist/editor/sidebar/SEOInfo.d.ts +1 -0
- package/dist/editor/sidebar/SEOInfo.js +169 -0
- package/dist/editor/sidebar/SEOInfo.js.map +1 -0
- package/dist/editor/sidebar/Sidebar.js +1 -1
- package/dist/editor/sidebar/Sidebar.js.map +1 -1
- package/dist/editor/sidebar/SidebarView.d.ts +3 -2
- package/dist/editor/sidebar/SidebarView.js +22 -60
- package/dist/editor/sidebar/SidebarView.js.map +1 -1
- package/dist/editor/sidebar/ViewSelector.js +66 -20
- package/dist/editor/sidebar/ViewSelector.js.map +1 -1
- package/dist/editor/ui/Icons.d.ts +4 -0
- package/dist/editor/ui/Icons.js +15 -3
- package/dist/editor/ui/Icons.js.map +1 -1
- package/dist/editor/ui/Section.js +1 -1
- package/dist/editor/ui/Section.js.map +1 -1
- package/dist/editor/ui/SimpleIconButton.d.ts +1 -2
- package/dist/editor/ui/SimpleIconButton.js +8 -13
- package/dist/editor/ui/SimpleIconButton.js.map +1 -1
- package/dist/editor/ui/SimpleTabs.js +2 -2
- package/dist/editor/ui/SimpleTabs.js.map +1 -1
- package/dist/editor/ui/SimpleToolbar.js +1 -1
- package/dist/editor/ui/SimpleToolbar.js.map +1 -1
- package/dist/editor/ui/Splitter.d.ts +4 -0
- package/dist/editor/ui/Splitter.js +6 -7
- package/dist/editor/ui/Splitter.js.map +1 -1
- package/dist/editor/views/CompareView.js +16 -4
- package/dist/editor/views/CompareView.js.map +1 -1
- package/dist/editor/views/SingleEditView.d.ts +2 -1
- package/dist/editor/views/SingleEditView.js +2 -2
- package/dist/editor/views/SingleEditView.js.map +1 -1
- package/dist/page-wizard/steps/ContentStep.js +1 -1
- package/dist/page-wizard/steps/ContentStep.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/splash-screen/NewPage.js +8 -6
- package/dist/splash-screen/NewPage.js.map +1 -1
- package/dist/splash-screen/RecentPages.js +3 -8
- package/dist/splash-screen/RecentPages.js.map +1 -1
- package/dist/styles.css +1519 -543
- package/dist/tour/Tour.js +79 -10
- package/dist/tour/Tour.js.map +1 -1
- package/dist/tour/default-tour.js +55 -45
- package/dist/tour/default-tour.js.map +1 -1
- package/dist/types.d.ts +19 -1
- package/package.json +13 -5
- package/src/components/ui/badge.tsx +46 -0
- package/src/components/ui/button.tsx +3 -3
- package/src/components/ui/command.tsx +184 -0
- package/src/components/ui/dialog.tsx +143 -0
- package/src/components/ui/dropdown-menu.tsx +257 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/menubar.tsx +276 -0
- package/src/components/ui/popover.tsx +113 -0
- package/src/components/ui/switch.tsx +31 -0
- package/src/components/ui/tooltip.tsx +61 -0
- package/src/config/config.tsx +102 -65
- package/src/config/types.ts +3 -3
- package/src/editor/ContentTree.tsx +1 -1
- package/src/editor/Editor.tsx +8 -2
- package/src/editor/FieldList.tsx +2 -2
- package/src/editor/FieldListField.tsx +1 -1
- package/src/editor/ImageEditor.tsx +44 -21
- package/src/editor/MainLayout.tsx +21 -16
- package/src/editor/MobileLayout.tsx +3 -2
- package/src/editor/PictureEditor.tsx +74 -45
- package/src/editor/Titlebar.tsx +12 -24
- package/src/editor/ai/GhostWriter.tsx +1 -1
- package/src/editor/client/EditorClient.tsx +55 -13
- package/src/editor/client/editContext.ts +5 -0
- package/src/editor/client/operations.ts +2 -2
- package/src/editor/client/pageModelBuilder.ts +3 -7
- package/src/editor/commands/itemCommands.tsx +272 -0
- package/src/editor/field-types/MultiLineText.tsx +1 -1
- package/src/editor/field-types/SingleLineText.tsx +1 -1
- package/src/editor/menubar/ActiveUsers.tsx +271 -5
- package/src/editor/menubar/ItemActionsMenu.tsx +89 -0
- package/src/editor/menubar/ItemLanguageVersion.tsx +7 -5
- package/src/editor/menubar/LanguageSelector.tsx +105 -134
- package/src/editor/menubar/PageSelector.tsx +25 -27
- package/src/editor/menubar/PageViewerControls.tsx +126 -78
- package/src/editor/menubar/PreviewSecondaryControls.tsx +0 -2
- package/src/editor/menubar/User.tsx +2 -2
- package/src/editor/menubar/VersionSelector.tsx +124 -99
- package/src/editor/menubar/WorkflowButton.tsx +115 -0
- package/src/editor/page-editor-chrome/FrameMenu.tsx +5 -5
- package/src/editor/page-editor-chrome/SuggestionHighlightings.tsx +2 -2
- package/src/editor/page-viewer/EditorForm.tsx +112 -87
- package/src/editor/page-viewer/PageViewer.tsx +75 -92
- package/src/editor/page-viewer/PageViewerFrame.tsx +1 -1
- package/src/editor/reviews/Comments.tsx +19 -20
- package/src/editor/reviews/SuggestedEdit.tsx +3 -3
- package/src/editor/services/contentService.ts +28 -0
- package/src/editor/services/editService.ts +12 -0
- package/src/editor/services/systemService.ts +5 -2
- package/src/editor/sidebar/ComponentTree.tsx +34 -12
- package/src/editor/sidebar/Divider.tsx +22 -0
- package/src/editor/sidebar/LeftToolbar.tsx +36 -0
- package/src/editor/sidebar/SEOInfo.tsx +265 -0
- package/src/editor/sidebar/Sidebar.tsx +1 -0
- package/src/editor/sidebar/SidebarView.tsx +77 -111
- package/src/editor/sidebar/ViewSelector.tsx +211 -43
- package/src/editor/ui/Icons.tsx +155 -10
- package/src/editor/ui/Section.tsx +1 -1
- package/src/editor/ui/SimpleIconButton.tsx +30 -28
- package/src/editor/ui/SimpleTabs.tsx +3 -3
- package/src/editor/ui/SimpleToolbar.tsx +1 -1
- package/src/editor/ui/Splitter.tsx +14 -7
- package/src/editor/views/CompareView.tsx +23 -11
- package/src/editor/views/SingleEditView.tsx +3 -0
- package/src/page-wizard/steps/ContentStep.tsx +0 -1
- package/src/revision.ts +2 -2
- package/src/splash-screen/NewPage.tsx +18 -13
- package/src/splash-screen/RecentPages.tsx +4 -10
- package/src/tour/Tour.tsx +125 -34
- package/src/tour/default-tour.tsx +55 -45
- package/src/types.ts +21 -1
- package/styles.css +301 -1
- package/dist/editor/menubar/ActionsMenu.js +0 -49
- package/dist/editor/menubar/ActionsMenu.js.map +0 -1
- package/dist/editor/menubar/SecondaryControls.d.ts +0 -1
- package/dist/editor/menubar/SecondaryControls.js +0 -17
- package/dist/editor/menubar/SecondaryControls.js.map +0 -1
- package/src/editor/menubar/ActionsMenu.tsx +0 -94
- package/src/editor/menubar/SecondaryControls.tsx +0 -45
|
@@ -7,6 +7,7 @@ import { VersionSelector } from "./VersionSelector";
|
|
|
7
7
|
import { NavButtons } from "./NavButtons";
|
|
8
8
|
import { getItemDescriptor } from "../utils";
|
|
9
9
|
import { confirmCreateVersion } from "../utils/itemutils";
|
|
10
|
+
import { ItemActionsMenu } from "./ItemActionsMenu";
|
|
10
11
|
|
|
11
12
|
export function ItemLanguageVersion() {
|
|
12
13
|
const editContext = useEditContext();
|
|
@@ -63,14 +64,15 @@ export function ItemLanguageVersion() {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
return (
|
|
66
|
-
<div className="flex items-center gap-
|
|
67
|
+
<div className="flex items-center gap-3">
|
|
67
68
|
<PageSelector itemDescriptor={item} />
|
|
68
|
-
<
|
|
69
|
+
<ItemActionsMenu isMobile={false} />
|
|
70
|
+
|
|
69
71
|
{languageSelector}
|
|
70
|
-
<Separator />
|
|
71
72
|
{versionSelector}
|
|
72
|
-
|
|
73
|
-
<
|
|
73
|
+
|
|
74
|
+
{/* <Separator /> */}
|
|
75
|
+
{/* <NavButtons /> */}
|
|
74
76
|
</div>
|
|
75
77
|
);
|
|
76
78
|
}
|
|
@@ -1,32 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { useRef, useState } from "react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Check, ChevronsUpDown } from "lucide-react";
|
|
6
5
|
import { InputSwitch } from "primereact/inputswitch";
|
|
7
6
|
import { useEditContext } from "../client/editContext";
|
|
8
|
-
|
|
9
7
|
import { Language } from "../pageModel";
|
|
8
|
+
import { cn } from "../../lib/utils";
|
|
9
|
+
import { Button } from "../../components/ui/button";
|
|
10
|
+
import { Switch } from "../../components/ui/switch";
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
Command,
|
|
14
|
+
CommandEmpty,
|
|
15
|
+
CommandGroup,
|
|
16
|
+
CommandInput,
|
|
17
|
+
CommandItem,
|
|
18
|
+
CommandList,
|
|
19
|
+
} from "../../components/ui/command";
|
|
20
|
+
import {
|
|
21
|
+
Popover,
|
|
22
|
+
PopoverContent,
|
|
23
|
+
PopoverTrigger,
|
|
24
|
+
} from "../../components/ui/popover";
|
|
10
25
|
|
|
11
26
|
export function LanguageSelector({
|
|
12
27
|
selectedLanguage,
|
|
13
|
-
darkMode,
|
|
14
28
|
onLanguageSelected,
|
|
15
29
|
showAllLanguagesSwitch,
|
|
16
30
|
showAllLanguages = false,
|
|
17
31
|
disabled = false,
|
|
18
32
|
}: {
|
|
19
33
|
selectedLanguage: string | undefined;
|
|
20
|
-
darkMode?: boolean;
|
|
21
34
|
onLanguageSelected: (language: Language) => void;
|
|
22
35
|
showAllLanguagesSwitch?: boolean;
|
|
23
36
|
showAllLanguages?: boolean;
|
|
24
37
|
disabled?: boolean;
|
|
25
38
|
}) {
|
|
26
|
-
const
|
|
39
|
+
const [open, setOpen] = React.useState(false);
|
|
27
40
|
const [showAllLanguagesInternal, setShowAllLanguagesInternal] =
|
|
28
|
-
useState(showAllLanguages);
|
|
29
|
-
const [filterText, setFilterText] = useState("");
|
|
41
|
+
React.useState(showAllLanguages);
|
|
42
|
+
const [filterText, setFilterText] = React.useState("");
|
|
30
43
|
const editContext = useEditContext();
|
|
31
44
|
|
|
32
45
|
const allLanguages = editContext?.itemLanguages || [];
|
|
@@ -50,20 +63,18 @@ export function LanguageSelector({
|
|
|
50
63
|
|
|
51
64
|
const selectLanguage = async (language: Language) => {
|
|
52
65
|
onLanguageSelected(language);
|
|
53
|
-
|
|
66
|
+
setOpen(false);
|
|
54
67
|
// Reset filter when language is selected
|
|
55
68
|
setFilterText("");
|
|
56
69
|
return;
|
|
57
70
|
};
|
|
58
71
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// Reset filter when panel closes
|
|
66
|
-
setFilterText("");
|
|
72
|
+
const handleOpenChange = (open: boolean) => {
|
|
73
|
+
setOpen(open);
|
|
74
|
+
if (!open) {
|
|
75
|
+
// Reset filter when popover closes
|
|
76
|
+
setFilterText("");
|
|
77
|
+
}
|
|
67
78
|
};
|
|
68
79
|
|
|
69
80
|
// Function to highlight matching characters
|
|
@@ -84,49 +95,37 @@ export function LanguageSelector({
|
|
|
84
95
|
};
|
|
85
96
|
|
|
86
97
|
return (
|
|
87
|
-
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (disabled) return;
|
|
97
|
-
overlaypanel.current?.toggle(ev, ev.currentTarget);
|
|
98
|
-
}}
|
|
99
|
-
>
|
|
100
|
-
<div className="flex gap-2">
|
|
101
|
-
{currentLanguage && (
|
|
102
|
-
<>
|
|
103
|
-
<img src={currentLanguage.icon} className="h-5" />{" "}
|
|
104
|
-
{currentLanguage.name}
|
|
105
|
-
</>
|
|
98
|
+
<Popover open={open} onOpenChange={handleOpenChange}>
|
|
99
|
+
<PopoverTrigger asChild>
|
|
100
|
+
<Button
|
|
101
|
+
variant="outline"
|
|
102
|
+
role="combobox"
|
|
103
|
+
aria-expanded={open}
|
|
104
|
+
className={cn(
|
|
105
|
+
"text-dark border-gray-3 text-2xs roundedborder flex h-8 w-auto min-w-[120px] cursor-pointer items-center justify-between gap-3 p-[7px] font-medium hover:bg-gray-50",
|
|
106
|
+
disabled ? "cursor-not-allowed opacity-50" : "",
|
|
106
107
|
)}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<div
|
|
110
|
-
className={`p-dropdown-trigger ${
|
|
111
|
-
darkMode ? "text-gray-500" : "text-gray-200"
|
|
112
|
-
}`}
|
|
113
|
-
role="button"
|
|
114
|
-
aria-haspopup="listbox"
|
|
115
|
-
aria-expanded="false"
|
|
116
|
-
aria-label="Select a language"
|
|
117
|
-
data-pc-section="trigger"
|
|
108
|
+
data-testid="language-selector"
|
|
109
|
+
disabled={disabled}
|
|
118
110
|
>
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
111
|
+
<div className="flex items-center gap-2">
|
|
112
|
+
{currentLanguage && (
|
|
113
|
+
<>
|
|
114
|
+
<img
|
|
115
|
+
src={currentLanguage.icon}
|
|
116
|
+
className="h-5"
|
|
117
|
+
alt={currentLanguage.name}
|
|
118
|
+
/>
|
|
119
|
+
{currentLanguage.name}
|
|
120
|
+
</>
|
|
121
|
+
)}
|
|
122
|
+
{!currentLanguage && <div>Select language</div>}
|
|
123
|
+
</div>
|
|
124
|
+
<ChevronsUpDown className="h-4 w-4 shrink-0 opacity-50" />
|
|
125
|
+
</Button>
|
|
126
|
+
</PopoverTrigger>
|
|
127
|
+
<PopoverContent className="w-64 p-0" align="start">
|
|
128
|
+
<Command>
|
|
130
129
|
{showAllLanguagesSwitch && (
|
|
131
130
|
<div className="flex items-center justify-center gap-2 p-2 text-xs">
|
|
132
131
|
<span
|
|
@@ -135,9 +134,12 @@ export function LanguageSelector({
|
|
|
135
134
|
>
|
|
136
135
|
Item languages
|
|
137
136
|
</span>
|
|
138
|
-
|
|
137
|
+
|
|
138
|
+
<Switch
|
|
139
139
|
checked={showAllLanguagesInternal}
|
|
140
|
-
|
|
140
|
+
onCheckedChange={(checked) =>
|
|
141
|
+
setShowAllLanguagesInternal(checked)
|
|
142
|
+
}
|
|
141
143
|
/>
|
|
142
144
|
<span
|
|
143
145
|
className="cursor-pointer"
|
|
@@ -147,80 +149,49 @@ export function LanguageSelector({
|
|
|
147
149
|
</span>
|
|
148
150
|
</div>
|
|
149
151
|
)}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
/>
|
|
170
|
-
)}
|
|
171
|
-
</div>
|
|
172
|
-
</div>
|
|
173
|
-
|
|
174
|
-
<div className="flex-1 overflow-y-auto">
|
|
175
|
-
<div className="flex flex-col text-sm">
|
|
176
|
-
{languages.map((x) => (
|
|
177
|
-
<div
|
|
178
|
-
key={x.languageCode}
|
|
179
|
-
className="flex cursor-pointer items-center p-2 hover:bg-gray-200"
|
|
180
|
-
onClick={() => selectLanguage(x)}
|
|
152
|
+
<CommandInput
|
|
153
|
+
placeholder="Filter languages..."
|
|
154
|
+
value={filterText}
|
|
155
|
+
onValueChange={setFilterText}
|
|
156
|
+
className="my-2"
|
|
157
|
+
/>
|
|
158
|
+
<CommandList className="max-h-[50vh]">
|
|
159
|
+
<CommandEmpty>
|
|
160
|
+
{filterText.trim()
|
|
161
|
+
? `No languages found matching "${filterText}"`
|
|
162
|
+
: "This item has no languages"}
|
|
163
|
+
</CommandEmpty>
|
|
164
|
+
<CommandGroup>
|
|
165
|
+
{languages.map((language) => (
|
|
166
|
+
<CommandItem
|
|
167
|
+
key={language.languageCode}
|
|
168
|
+
value={language.languageCode}
|
|
169
|
+
onSelect={() => selectLanguage(language)}
|
|
170
|
+
className="flex items-center gap-2 px-2 py-2 text-xs"
|
|
181
171
|
>
|
|
182
|
-
<img
|
|
183
|
-
|
|
184
|
-
|
|
172
|
+
<img
|
|
173
|
+
src={language.icon}
|
|
174
|
+
className="h-5 w-5 shrink-0"
|
|
175
|
+
alt={language.name}
|
|
176
|
+
/>
|
|
177
|
+
<span className="flex-1">
|
|
178
|
+
{highlightMatch(language.name, filterText)} (
|
|
179
|
+
{language.versions})
|
|
180
|
+
</span>
|
|
181
|
+
<Check
|
|
182
|
+
className={cn(
|
|
183
|
+
"h-4 w-4",
|
|
184
|
+
selectedLanguage === language.languageCode
|
|
185
|
+
? "opacity-100"
|
|
186
|
+
: "opacity-0",
|
|
187
|
+
)}
|
|
188
|
+
/>
|
|
189
|
+
</CommandItem>
|
|
185
190
|
))}
|
|
186
|
-
</
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
)}
|
|
192
|
-
{languages.length === 0 && !filterText.trim() && (
|
|
193
|
-
<div className="p-2 text-gray-500">
|
|
194
|
-
This item has no languages
|
|
195
|
-
</div>
|
|
196
|
-
)}
|
|
197
|
-
</div>
|
|
198
|
-
</div>
|
|
199
|
-
{/* {!readOnly && (
|
|
200
|
-
<div className="border-t p-2 flex flex-col">
|
|
201
|
-
<div className="text-xs text-gray-500 mb-2 flex items-center gap-1">
|
|
202
|
-
<ArrowDownIcon /> Actions
|
|
203
|
-
</div>
|
|
204
|
-
<div className="flex gap-2">
|
|
205
|
-
<Button
|
|
206
|
-
size="small"
|
|
207
|
-
icon="pi pi-globe"
|
|
208
|
-
label="Localize"
|
|
209
|
-
onClick={(event) => {
|
|
210
|
-
if (!editContext?.contentEditorItem) return;
|
|
211
|
-
editContext?.executeCommand({
|
|
212
|
-
command: editContext.configuration.commands.localizeItem,
|
|
213
|
-
data: {
|
|
214
|
-
items: [editContext.contentEditorItem],
|
|
215
|
-
},
|
|
216
|
-
event,
|
|
217
|
-
});
|
|
218
|
-
}}
|
|
219
|
-
></Button>
|
|
220
|
-
</div>
|
|
221
|
-
</div>
|
|
222
|
-
)} */}
|
|
223
|
-
</OverlayPanel>
|
|
224
|
-
</>
|
|
191
|
+
</CommandGroup>
|
|
192
|
+
</CommandList>
|
|
193
|
+
</Command>
|
|
194
|
+
</PopoverContent>
|
|
195
|
+
</Popover>
|
|
225
196
|
);
|
|
226
197
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
|
2
|
-
import { OverlayPanel } from "primereact/overlaypanel";
|
|
3
2
|
import { useEditContext } from "../client/editContext";
|
|
4
|
-
|
|
5
|
-
import { ArrowDownIcon } from "../ui/Icons";
|
|
3
|
+
|
|
6
4
|
import { InputText } from "primereact/inputtext";
|
|
7
5
|
import { ProgressSpinner } from "primereact/progressspinner";
|
|
8
6
|
import { useDebouncedCallback } from "use-debounce";
|
|
@@ -15,13 +13,18 @@ import { ItemTreeNodeData } from "../services/contentService";
|
|
|
15
13
|
import { SimpleIconButton } from "../ui/SimpleIconButton";
|
|
16
14
|
import { executeSearch } from "../services/aiService";
|
|
17
15
|
import { ItemList } from "../ui/ItemList";
|
|
16
|
+
import { DotsVerticalIcon } from "@radix-ui/react-icons";
|
|
17
|
+
import {
|
|
18
|
+
Popover,
|
|
19
|
+
PopoverContent,
|
|
20
|
+
PopoverTrigger,
|
|
21
|
+
} from "../../components/ui/popover";
|
|
18
22
|
|
|
19
23
|
export function PageSelector({
|
|
20
24
|
itemDescriptor,
|
|
21
25
|
}: {
|
|
22
26
|
itemDescriptor: ItemDescriptor;
|
|
23
27
|
}) {
|
|
24
|
-
const overlaypanel = useRef<OverlayPanel>(null);
|
|
25
28
|
const editContext = useEditContext();
|
|
26
29
|
const [item, setItem] = useState<FullItem | undefined>();
|
|
27
30
|
const [showHistory, setShowHistory] = useState(false);
|
|
@@ -30,6 +33,7 @@ export function PageSelector({
|
|
|
30
33
|
const [searchResults, setSearchResults] = useState<ResultItem[]>([]);
|
|
31
34
|
const [historyResults, setHistoryResults] = useState<ResultItem[]>([]);
|
|
32
35
|
const [loading, setLoading] = useState(false);
|
|
36
|
+
const [open, setOpen] = useState(false);
|
|
33
37
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
34
38
|
|
|
35
39
|
const loadItem = (
|
|
@@ -48,7 +52,7 @@ export function PageSelector({
|
|
|
48
52
|
language: itemDescriptor.language,
|
|
49
53
|
version: itemDescriptor.version || 0,
|
|
50
54
|
});
|
|
51
|
-
|
|
55
|
+
setOpen(false);
|
|
52
56
|
};
|
|
53
57
|
|
|
54
58
|
const handleSearch = useDebouncedCallback(async (searchPrompt: string) => {
|
|
@@ -165,10 +169,10 @@ export function PageSelector({
|
|
|
165
169
|
}, [itemDescriptor]);
|
|
166
170
|
|
|
167
171
|
useEffect(() => {
|
|
168
|
-
if (inputRef.current) {
|
|
172
|
+
if (inputRef.current && open) {
|
|
169
173
|
inputRef.current.focus();
|
|
170
174
|
}
|
|
171
|
-
}, [showHistory]);
|
|
175
|
+
}, [open, showHistory]);
|
|
172
176
|
|
|
173
177
|
if (!editContext) return null;
|
|
174
178
|
|
|
@@ -176,27 +180,21 @@ export function PageSelector({
|
|
|
176
180
|
const hasResults = currentResults.length > 0;
|
|
177
181
|
|
|
178
182
|
return (
|
|
179
|
-
|
|
180
|
-
<
|
|
181
|
-
id="page-selector-button"
|
|
182
|
-
className="flex cursor-pointer items-center gap-3 rounded-md p-[7px] py-[5px] text-sm text-gray-200 hover:bg-gray-500"
|
|
183
|
-
onClick={(ev) => overlaypanel.current?.toggle(ev, ev.currentTarget)}
|
|
184
|
-
data-testid="page-selector-button"
|
|
185
|
-
>
|
|
186
|
-
{item?.name || "unknown"}
|
|
183
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
184
|
+
<PopoverTrigger asChild>
|
|
187
185
|
<div
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
aria-expanded="false"
|
|
192
|
-
aria-label="Select a page"
|
|
193
|
-
data-pc-section="trigger"
|
|
186
|
+
id="page-selector-button"
|
|
187
|
+
className="text-dark text-sm0 flex cursor-pointer items-center gap-3 rounded-md p-[7px] py-[9px]"
|
|
188
|
+
data-testid="page-selector-button"
|
|
194
189
|
>
|
|
195
|
-
<
|
|
190
|
+
<div className="flex flex-col">
|
|
191
|
+
<div className="text-sm font-medium">{item?.name || "unknown"}</div>
|
|
192
|
+
<div className="text-xs text-gray-500">{item?.path}</div>
|
|
193
|
+
</div>
|
|
196
194
|
</div>
|
|
197
|
-
</
|
|
198
|
-
<
|
|
199
|
-
<div className="flex h-[75vh] max-w-96 min-w-96 flex-col overflow-hidden">
|
|
195
|
+
</PopoverTrigger>
|
|
196
|
+
<PopoverContent className="w-96 p-0" align="start">
|
|
197
|
+
<div className="flex h-[75vh] max-h-[600px] max-w-96 min-w-96 flex-col overflow-hidden">
|
|
200
198
|
{/* Search/Filter bar with view toggle buttons */}
|
|
201
199
|
<div className="flex gap-2 border-b border-gray-200 p-2">
|
|
202
200
|
<div className="relative flex-1">
|
|
@@ -272,7 +270,7 @@ export function PageSelector({
|
|
|
272
270
|
</div>
|
|
273
271
|
</div>
|
|
274
272
|
</div>
|
|
275
|
-
</
|
|
276
|
-
|
|
273
|
+
</PopoverContent>
|
|
274
|
+
</Popover>
|
|
277
275
|
);
|
|
278
276
|
}
|