@alpaca-editor/core 1.0.3956 → 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
|
@@ -15,6 +15,12 @@ import {
|
|
|
15
15
|
FieldActionsOverlay,
|
|
16
16
|
FieldActionsOverlayRef,
|
|
17
17
|
} from "./FieldActionsOverlay";
|
|
18
|
+
import {
|
|
19
|
+
DropdownMenu,
|
|
20
|
+
DropdownMenuContent,
|
|
21
|
+
DropdownMenuItem,
|
|
22
|
+
DropdownMenuTrigger,
|
|
23
|
+
} from "../components/ui/dropdown-menu";
|
|
18
24
|
|
|
19
25
|
export function PictureEditor({
|
|
20
26
|
field,
|
|
@@ -156,8 +162,6 @@ export function PictureEditor({
|
|
|
156
162
|
return (
|
|
157
163
|
<div
|
|
158
164
|
className="absolute inset-0 flex items-center justify-center"
|
|
159
|
-
onMouseEnter={() => setShowMenu(true)}
|
|
160
|
-
onMouseLeave={() => setShowMenu(false)}
|
|
161
165
|
onClick={() => {
|
|
162
166
|
if (!isPageEditor) return;
|
|
163
167
|
const itemId = field.descriptor.item?.id;
|
|
@@ -183,68 +187,93 @@ export function PictureEditor({
|
|
|
183
187
|
style={style}
|
|
184
188
|
data-testid="select-media"
|
|
185
189
|
>
|
|
186
|
-
{
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
onClick={() =>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
{/* Dropdown menu with button in bottom right corner */}
|
|
191
|
+
<DropdownMenu open={showMenu} onOpenChange={setShowMenu}>
|
|
192
|
+
<DropdownMenuTrigger asChild>
|
|
193
|
+
<button
|
|
194
|
+
className="absolute right-2 bottom-2 flex h-8 w-8 items-center justify-center rounded-full border bg-gray-500 text-white opacity-70 shadow-lg transition-opacity hover:opacity-85"
|
|
195
|
+
onClick={(e) => {
|
|
196
|
+
e.stopPropagation();
|
|
197
|
+
}}
|
|
198
|
+
data-testid="menu-toggle-button"
|
|
199
|
+
>
|
|
200
|
+
<i className="pi pi-ellipsis-v text-xs" />
|
|
201
|
+
</button>
|
|
202
|
+
</DropdownMenuTrigger>
|
|
203
|
+
<DropdownMenuContent align="end" side="top" sideOffset={8}>
|
|
204
|
+
<DropdownMenuItem
|
|
205
|
+
onClick={() => {
|
|
206
|
+
selectMedia("images");
|
|
207
|
+
setShowMenu(false);
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
<i className="pi pi-image" />
|
|
211
|
+
Select
|
|
212
|
+
</DropdownMenuItem>
|
|
213
|
+
|
|
195
214
|
{field.value?.allowVideos && (
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
215
|
+
<DropdownMenuItem
|
|
216
|
+
onClick={() => {
|
|
217
|
+
selectVideo();
|
|
218
|
+
setShowMenu(false);
|
|
219
|
+
}}
|
|
220
|
+
>
|
|
221
|
+
<i className="pi pi-video" />
|
|
222
|
+
Video
|
|
223
|
+
</DropdownMenuItem>
|
|
203
224
|
)}
|
|
225
|
+
|
|
204
226
|
{notEmpty && (
|
|
205
|
-
<
|
|
206
|
-
label="Crop"
|
|
207
|
-
icon="pi pi-expand"
|
|
227
|
+
<DropdownMenuItem
|
|
208
228
|
onClick={() => {
|
|
209
229
|
setShowCropper(true);
|
|
230
|
+
setShowMenu(false);
|
|
210
231
|
}}
|
|
211
|
-
|
|
212
|
-
className="
|
|
213
|
-
|
|
232
|
+
>
|
|
233
|
+
<i className="pi pi-expand" />
|
|
234
|
+
Crop
|
|
235
|
+
</DropdownMenuItem>
|
|
214
236
|
)}
|
|
237
|
+
|
|
215
238
|
{rawVariant && (
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
239
|
+
<DropdownMenuItem
|
|
240
|
+
onClick={() => {
|
|
241
|
+
reset();
|
|
242
|
+
setShowMenu(false);
|
|
243
|
+
}}
|
|
244
|
+
>
|
|
245
|
+
<i className="pi pi-times" />
|
|
246
|
+
Reset
|
|
247
|
+
</DropdownMenuItem>
|
|
223
248
|
)}
|
|
249
|
+
|
|
224
250
|
{fieldButtons.map((button) => (
|
|
225
|
-
<
|
|
251
|
+
<DropdownMenuItem
|
|
226
252
|
key={button.id}
|
|
227
|
-
label={button.label}
|
|
228
|
-
icon={
|
|
229
|
-
button.isGenerator
|
|
230
|
-
? "pi pi-cog"
|
|
231
|
-
: button.icon && button.icon.trim() !== ""
|
|
232
|
-
? button.icon
|
|
233
|
-
: "pi pi-bolt"
|
|
234
|
-
}
|
|
235
253
|
onClick={(e) => {
|
|
236
254
|
if (button.parameters && button.parameters.length > 0) {
|
|
237
255
|
fieldActionsOverlay.current?.show(e, button);
|
|
238
256
|
} else {
|
|
239
257
|
handleActionClick(button);
|
|
240
258
|
}
|
|
259
|
+
setShowMenu(false);
|
|
241
260
|
}}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
261
|
+
>
|
|
262
|
+
<i
|
|
263
|
+
className={
|
|
264
|
+
button.isGenerator
|
|
265
|
+
? "pi pi-cog"
|
|
266
|
+
: button.icon && button.icon.trim() !== ""
|
|
267
|
+
? button.icon
|
|
268
|
+
: "pi pi-bolt"
|
|
269
|
+
}
|
|
270
|
+
/>
|
|
271
|
+
{button.label}
|
|
272
|
+
</DropdownMenuItem>
|
|
245
273
|
))}
|
|
246
|
-
</
|
|
247
|
-
|
|
274
|
+
</DropdownMenuContent>
|
|
275
|
+
</DropdownMenu>
|
|
276
|
+
|
|
248
277
|
{showCropper && (
|
|
249
278
|
<PictureCropper
|
|
250
279
|
field={field}
|
package/src/editor/Titlebar.tsx
CHANGED
|
@@ -3,6 +3,9 @@ import { useEditContext } from "./client/editContext";
|
|
|
3
3
|
import { useEffect, useState, useRef } from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
5
|
import { Logo } from "./ui/Icons";
|
|
6
|
+
import { ActiveUsers } from "./menubar/ActiveUsers";
|
|
7
|
+
import { ItemLanguageVersion } from "./menubar/ItemLanguageVersion";
|
|
8
|
+
import { WorkflowButton } from "./menubar/WorkflowButton";
|
|
6
9
|
|
|
7
10
|
export function Titlebar() {
|
|
8
11
|
const editContext = useEditContext();
|
|
@@ -17,7 +20,7 @@ export function Titlebar() {
|
|
|
17
20
|
// Get custom title from view's headerTitle function, or fall back to "workbench"
|
|
18
21
|
const title = editContext.view.headerTitle
|
|
19
22
|
? editContext.view.headerTitle(editContext)
|
|
20
|
-
: "
|
|
23
|
+
: "";
|
|
21
24
|
|
|
22
25
|
useEffect(() => {
|
|
23
26
|
setMenuOpen(false);
|
|
@@ -54,29 +57,15 @@ export function Titlebar() {
|
|
|
54
57
|
}, [menuOpen]);
|
|
55
58
|
|
|
56
59
|
return (
|
|
57
|
-
<div className="z-1 flex
|
|
58
|
-
<div className="relative flex items-center justify-center gap-2 pl-2 font-bold text-white">
|
|
59
|
-
<a
|
|
60
|
-
//href="/sitecore/shell/sitecore/client/Applications/Launchpad"
|
|
61
|
-
onClick={() => {
|
|
62
|
-
editContext.switchView("splash-screen");
|
|
63
|
-
}}
|
|
64
|
-
className="glow-text flex cursor-pointer items-center"
|
|
65
|
-
>
|
|
66
|
-
<Logo className="h-6 w-6" />
|
|
67
|
-
<span className="ml-2 font-mono">{title}</span>
|
|
68
|
-
</a>
|
|
69
|
-
</div>
|
|
70
|
-
<div>{editContext?.view.primaryControls}</div>
|
|
60
|
+
<div className="z-1 flex h-12 items-center justify-between gap-1 border-b border-gray-200 bg-white px-4">
|
|
71
61
|
{/* Desktop View */}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
<ItemLanguageVersion />
|
|
63
|
+
<div className="flex items-center gap-3">
|
|
64
|
+
<ActiveUsers />
|
|
65
|
+
<WorkflowButton />
|
|
66
|
+
</div>
|
|
78
67
|
{/* Mobile View - Burger Menu */}
|
|
79
|
-
{isMobile && editContext?.view.secondaryControls && (
|
|
68
|
+
{/* {isMobile && editContext?.view.secondaryControls && (
|
|
80
69
|
<>
|
|
81
70
|
<button
|
|
82
71
|
ref={buttonRef}
|
|
@@ -97,8 +86,7 @@ export function Titlebar() {
|
|
|
97
86
|
</div>,
|
|
98
87
|
document.body,
|
|
99
88
|
)}
|
|
100
|
-
</>
|
|
101
|
-
)}
|
|
89
|
+
</> )}*/}
|
|
102
90
|
</div>
|
|
103
91
|
);
|
|
104
92
|
}
|
|
@@ -450,7 +450,7 @@ export function GhostWriter() {
|
|
|
450
450
|
|
|
451
451
|
<div className="ai-thinking flex-1 overflow-auto text-sm">
|
|
452
452
|
<label className="mb-2 block font-medium">AI Thinking</label>
|
|
453
|
-
<div className="max-h-[400px] min-h-[200px] overflow-y-auto rounded border
|
|
453
|
+
<div className="max-h-[400px] min-h-[200px] overflow-y-auto rounded border p-3 text-xs">
|
|
454
454
|
{messages.length > 0 ? (
|
|
455
455
|
<AiResponseMessage
|
|
456
456
|
messages={messages}
|
|
@@ -85,6 +85,7 @@ import {
|
|
|
85
85
|
Comment,
|
|
86
86
|
SuggestedEdit,
|
|
87
87
|
UserInfo,
|
|
88
|
+
UserPreferences,
|
|
88
89
|
} from "../../types";
|
|
89
90
|
|
|
90
91
|
import { post } from "../services/serviceHelper";
|
|
@@ -120,6 +121,8 @@ import { flushSync } from "react-dom";
|
|
|
120
121
|
import { getSuggestedEdits } from "../services/suggestedEditsService";
|
|
121
122
|
import { usePageWizard } from "../../page-wizard/usePageWizard";
|
|
122
123
|
import { requestQuota } from "../services/aiService";
|
|
124
|
+
import { saveUserPreferences } from "../services/systemService";
|
|
125
|
+
import { Shrink } from "lucide-react";
|
|
123
126
|
|
|
124
127
|
export type FieldAction = {
|
|
125
128
|
field: FieldDescriptor;
|
|
@@ -163,12 +166,16 @@ export function EditorClient({
|
|
|
163
166
|
item: loadItemDescriptor,
|
|
164
167
|
sessionId,
|
|
165
168
|
userInfo,
|
|
169
|
+
userPreferences,
|
|
170
|
+
setUserPreferences,
|
|
166
171
|
}: {
|
|
167
172
|
configuration: EditorConfiguration;
|
|
168
173
|
className?: string;
|
|
169
174
|
item?: ItemDescriptor;
|
|
170
175
|
sessionId: string;
|
|
171
176
|
userInfo: UserInfo;
|
|
177
|
+
userPreferences: UserPreferences;
|
|
178
|
+
setUserPreferences: (preferences: Partial<UserPreferences>) => void;
|
|
172
179
|
}) {
|
|
173
180
|
const router = useRouter();
|
|
174
181
|
|
|
@@ -269,6 +276,7 @@ export function EditorClient({
|
|
|
269
276
|
const [suggestedEdits, setSuggestedEdits] = useState<SuggestedEdit[]>([]);
|
|
270
277
|
const [showSuggestedEdits, setShowSuggestedEdits] = useState(false);
|
|
271
278
|
const [showSuggestedEditsDiff, setShowSuggestedEditsDiff] = useState(false);
|
|
279
|
+
|
|
272
280
|
const [showComments, setShowComments] = useState<boolean>(() => {
|
|
273
281
|
const savedShowComments =
|
|
274
282
|
typeof window !== "undefined"
|
|
@@ -286,11 +294,21 @@ export function EditorClient({
|
|
|
286
294
|
const [selectedComment, setSelectedComment] = useState<Comment>();
|
|
287
295
|
|
|
288
296
|
const [browseHistory, setBrowseHistory] = useState<HistoryEntry[]>(() => {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
297
|
+
// Convert UserBrowseHistoryEntry[] to HistoryEntry[]
|
|
298
|
+
if (!userInfo.browseHistory) return [];
|
|
299
|
+
|
|
300
|
+
return userInfo.browseHistory.map(
|
|
301
|
+
(entry): HistoryEntry => ({
|
|
302
|
+
name: entry.itemName,
|
|
303
|
+
path: entry.itemPath,
|
|
304
|
+
id: entry.itemId,
|
|
305
|
+
version: entry.itemVersion,
|
|
306
|
+
language: entry.itemLanguage,
|
|
307
|
+
hasLayout: false, // This will need to be determined from the item
|
|
308
|
+
templateName: "", // This will need to be determined from the item
|
|
309
|
+
icon: undefined,
|
|
310
|
+
}),
|
|
311
|
+
);
|
|
294
312
|
});
|
|
295
313
|
|
|
296
314
|
const [centerPanelView, setCenterPanelView] = useState<ReactNode>();
|
|
@@ -307,6 +325,9 @@ export function EditorClient({
|
|
|
307
325
|
const [focusFieldComponentId, setFocusFieldComponentId] = useState<string>();
|
|
308
326
|
|
|
309
327
|
const [enableCompletions, setEnableCompletions] = useState(false);
|
|
328
|
+
const [showRightSidebar, setShowRightSidebar] = useState(
|
|
329
|
+
userPreferences.showRightSidebar ?? true,
|
|
330
|
+
);
|
|
310
331
|
const [quotaInfo, setQuotaInfo] = useState<QuotaInfo | null>(null);
|
|
311
332
|
const pageWizard = usePageWizard();
|
|
312
333
|
|
|
@@ -414,6 +435,15 @@ export function EditorClient({
|
|
|
414
435
|
setIsTourActive(true);
|
|
415
436
|
};
|
|
416
437
|
|
|
438
|
+
const handleSetShowRightSidebar = (
|
|
439
|
+
value: boolean | ((prev: boolean) => boolean),
|
|
440
|
+
) => {
|
|
441
|
+
const newValue =
|
|
442
|
+
typeof value === "function" ? value(showRightSidebar) : value;
|
|
443
|
+
setShowRightSidebar(newValue);
|
|
444
|
+
setUserPreferences({ showRightSidebar: newValue });
|
|
445
|
+
};
|
|
446
|
+
|
|
417
447
|
const messageHandler = useCallback(
|
|
418
448
|
async (event: any) => {
|
|
419
449
|
if (!event.data.startsWith("{")) return;
|
|
@@ -1069,11 +1099,6 @@ export function EditorClient({
|
|
|
1069
1099
|
.slice(0, 25),
|
|
1070
1100
|
];
|
|
1071
1101
|
|
|
1072
|
-
localStorage.setItem(
|
|
1073
|
-
"editor.browseHistory",
|
|
1074
|
-
JSON.stringify(newHistory),
|
|
1075
|
-
);
|
|
1076
|
-
|
|
1077
1102
|
return newHistory;
|
|
1078
1103
|
});
|
|
1079
1104
|
},
|
|
@@ -2050,6 +2075,8 @@ export function EditorClient({
|
|
|
2050
2075
|
setShowSuggestedEditsDiff,
|
|
2051
2076
|
enableCompletions,
|
|
2052
2077
|
setEnableCompletions,
|
|
2078
|
+
showRightSidebar,
|
|
2079
|
+
setShowRightSidebar: handleSetShowRightSidebar,
|
|
2053
2080
|
quotaInfo,
|
|
2054
2081
|
isQuotaExceeded: isQuotaExceeded(),
|
|
2055
2082
|
getQuotaWarningMessage,
|
|
@@ -2058,7 +2085,9 @@ export function EditorClient({
|
|
|
2058
2085
|
pageWizard,
|
|
2059
2086
|
webSocketMessages,
|
|
2060
2087
|
clearWebSocketMessages: () => setWebSocketMessages([]),
|
|
2061
|
-
userInfo,
|
|
2088
|
+
userInfo: userInfo,
|
|
2089
|
+
userPreferences,
|
|
2090
|
+
setUserPreferences,
|
|
2062
2091
|
};
|
|
2063
2092
|
}, [
|
|
2064
2093
|
operations,
|
|
@@ -2131,6 +2160,8 @@ export function EditorClient({
|
|
|
2131
2160
|
setShowSuggestedEdits,
|
|
2132
2161
|
showSuggestedEditsDiff,
|
|
2133
2162
|
setShowSuggestedEditsDiff,
|
|
2163
|
+
showRightSidebar,
|
|
2164
|
+
handleSetShowRightSidebar,
|
|
2134
2165
|
quotaInfo,
|
|
2135
2166
|
isQuotaExceeded,
|
|
2136
2167
|
getQuotaWarningMessage,
|
|
@@ -2138,7 +2169,6 @@ export function EditorClient({
|
|
|
2138
2169
|
openDialog,
|
|
2139
2170
|
pageWizard,
|
|
2140
2171
|
webSocketMessages,
|
|
2141
|
-
userInfo,
|
|
2142
2172
|
]);
|
|
2143
2173
|
|
|
2144
2174
|
const modifiedFieldsContext = useMemo(() => {
|
|
@@ -2172,6 +2202,15 @@ export function EditorClient({
|
|
|
2172
2202
|
compareView={compareMode}
|
|
2173
2203
|
pageViewContext={pageViewContext}
|
|
2174
2204
|
/>
|
|
2205
|
+
{/* Return to normal button in top right corner */}
|
|
2206
|
+
<button
|
|
2207
|
+
onClick={() => pageViewContext.setFullscreen(false)}
|
|
2208
|
+
className="fixed top-4 right-4 z-50 flex h-10 w-10 items-center justify-center rounded-full bg-black/20 text-white backdrop-blur-sm transition-colors duration-200 hover:bg-black/40"
|
|
2209
|
+
aria-label="Exit fullscreen"
|
|
2210
|
+
title="Return to normal view"
|
|
2211
|
+
>
|
|
2212
|
+
<Shrink className="h-5 w-5" />
|
|
2213
|
+
</button>
|
|
2175
2214
|
</div>
|
|
2176
2215
|
{showFullscreenHint && (
|
|
2177
2216
|
<div
|
|
@@ -2198,11 +2237,14 @@ export function EditorClient({
|
|
|
2198
2237
|
view={currentView}
|
|
2199
2238
|
centerPanelView={centerPanelView}
|
|
2200
2239
|
rightSidebar={
|
|
2201
|
-
currentView.rightSidebar &&
|
|
2240
|
+
currentView.rightSidebar &&
|
|
2241
|
+
showRightSidebar && (
|
|
2202
2242
|
<SidebarView
|
|
2203
2243
|
sidebar={currentView.rightSidebar}
|
|
2204
2244
|
editContext={editContext}
|
|
2205
2245
|
active={true}
|
|
2246
|
+
detached={true}
|
|
2247
|
+
onClose={() => handleSetShowRightSidebar(false)}
|
|
2206
2248
|
/>
|
|
2207
2249
|
)
|
|
2208
2250
|
}
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
AddComponentOperation,
|
|
36
36
|
SuggestedEdit,
|
|
37
37
|
UserInfo,
|
|
38
|
+
UserPreferences,
|
|
38
39
|
} from "../../types";
|
|
39
40
|
|
|
40
41
|
import { ConfirmationProps } from "../ConfirmationDialog";
|
|
@@ -322,6 +323,9 @@ export type EditContextType = {
|
|
|
322
323
|
getQuotaWarningMessage: () => string | null;
|
|
323
324
|
isMobile: boolean;
|
|
324
325
|
|
|
326
|
+
showRightSidebar: boolean;
|
|
327
|
+
setShowRightSidebar: React.Dispatch<React.SetStateAction<boolean>>;
|
|
328
|
+
|
|
325
329
|
openDialog: OpenDialog;
|
|
326
330
|
|
|
327
331
|
pageWizard: {
|
|
@@ -354,6 +358,7 @@ export type EditContextType = {
|
|
|
354
358
|
webSocketMessages: WebSocketMessage[];
|
|
355
359
|
clearWebSocketMessages: () => void;
|
|
356
360
|
userInfo: UserInfo;
|
|
361
|
+
setUserPreferences: (preferences: Partial<UserPreferences>) => void;
|
|
357
362
|
};
|
|
358
363
|
|
|
359
364
|
const EditContext = React.createContext<EditContextType | undefined>(undefined);
|
|
@@ -732,7 +732,7 @@ async function getOrMergeSuggestedEditOp(
|
|
|
732
732
|
edit.itemId === item.id &&
|
|
733
733
|
edit.fieldId === field.fieldId &&
|
|
734
734
|
edit.author === (state.user?.name || "unknown") &&
|
|
735
|
-
edit.status === "
|
|
735
|
+
edit.status === "pending", // or any status that indicates it's open for further editing.
|
|
736
736
|
);
|
|
737
737
|
|
|
738
738
|
if (existing) {
|
|
@@ -758,7 +758,7 @@ async function getOrMergeSuggestedEditOp(
|
|
|
758
758
|
fieldId: field.fieldId,
|
|
759
759
|
oldValue: fieldItem.rawValue || "",
|
|
760
760
|
newValue: newVal || "",
|
|
761
|
-
status: "
|
|
761
|
+
status: "pending",
|
|
762
762
|
type: "FieldValue",
|
|
763
763
|
};
|
|
764
764
|
|
|
@@ -142,10 +142,7 @@ export function usePageModel(
|
|
|
142
142
|
: undefined;
|
|
143
143
|
|
|
144
144
|
const name =
|
|
145
|
-
skeleton.name ||
|
|
146
|
-
(datasourceItem?.name && skeleton.type
|
|
147
|
-
? `${datasourceItem.name} (${skeleton.type})`
|
|
148
|
-
: datasourceItem?.name || skeleton.type || "unknown");
|
|
145
|
+
skeleton.name || datasourceItem?.name || skeleton.type || "unknown";
|
|
149
146
|
|
|
150
147
|
const mapItem = (x: RenderedItemSkeleton): RenderedItem | null => {
|
|
151
148
|
const item = getItem(x);
|
|
@@ -166,7 +163,7 @@ export function usePageModel(
|
|
|
166
163
|
placeholders,
|
|
167
164
|
isShared: !(datasourceItem?.path.startsWith(pageItem.path) || true),
|
|
168
165
|
parentPlaceholder,
|
|
169
|
-
type: datasourceItem?.templateName ||
|
|
166
|
+
type: datasourceItem?.templateName || name, // TODO: We need the name for AI page wizard - we should not use the template name
|
|
170
167
|
typeId: skeleton.typeId || datasourceItem?.templateId || "",
|
|
171
168
|
canBeMoved:
|
|
172
169
|
!datasourceItem ||
|
|
@@ -178,7 +175,6 @@ export function usePageModel(
|
|
|
178
175
|
const editable = options?.editable ?? false;
|
|
179
176
|
const insOpts = options?.insertOptions ?? [];
|
|
180
177
|
|
|
181
|
-
|
|
182
178
|
const placeholder: Placeholder = {
|
|
183
179
|
...x,
|
|
184
180
|
components: [],
|
|
@@ -210,7 +206,7 @@ export function usePageModel(
|
|
|
210
206
|
editRevision: pageSkeleton.editRevision,
|
|
211
207
|
};
|
|
212
208
|
|
|
213
|
-
|
|
209
|
+
console.log("Page model updated", page);
|
|
214
210
|
setPage(page);
|
|
215
211
|
};
|
|
216
212
|
|