@alpaca-editor/core 1.0.0 → 1.0.3764-editor-mono
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/client-components/api.js +6 -0
- package/dist/client-components/index.js +36 -0
- package/dist/components/ActionButton.js +9 -0
- package/dist/components/Error.js +28 -0
- package/dist/config/config.js +654 -0
- package/dist/config/types.js +2 -0
- package/dist/editor/ComponentInfo.js +31 -0
- package/dist/editor/ConfirmationDialog.js +32 -0
- package/dist/editor/ContentTree.js +406 -0
- package/dist/editor/ContextMenu.js +117 -0
- package/dist/editor/Editor.js +55 -0
- package/dist/editor/EditorWarning.js +13 -0
- package/dist/editor/EditorWarnings.js +24 -0
- package/dist/editor/FieldEditorPopup.js +24 -0
- package/dist/editor/FieldHistory.js +40 -0
- package/dist/editor/FieldList.js +63 -0
- package/dist/editor/FieldListField.js +164 -0
- package/dist/editor/FieldListFieldWithFallbacks.js +114 -0
- package/dist/editor/FloatingToolbar.js +92 -0
- package/dist/editor/ImageEditor.js +55 -0
- package/dist/editor/InsertMenu.js +164 -0
- package/dist/editor/ItemInfo.js +30 -0
- package/dist/editor/LinkEditorDialog.js +89 -0
- package/dist/editor/MainLayout.js +46 -0
- package/dist/editor/NewEditorClient.js +9 -0
- package/dist/editor/PictureCropper.js +332 -0
- package/dist/editor/PictureEditor.js +104 -0
- package/dist/editor/PictureEditorDialog.js +194 -0
- package/dist/editor/ScrollingContentTree.js +30 -0
- package/dist/editor/Terminal.js +109 -0
- package/dist/editor/Titlebar.js +11 -0
- package/dist/editor/ai/AiPopup.js +25 -0
- package/dist/editor/ai/AiResponseMessage.js +24 -0
- package/dist/editor/ai/AiTerminal.js +241 -0
- package/dist/editor/ai/AiToolCall.js +18 -0
- package/dist/editor/ai/EditorAiTerminal.js +9 -0
- package/dist/editor/ai/editorAiContext.js +14 -0
- package/dist/editor/client/DialogContext.js +29 -0
- package/dist/editor/client/EditorClient.js +1336 -0
- package/dist/editor/client/GenericDialog.js +27 -0
- package/dist/editor/client/editContext.js +59 -0
- package/dist/editor/client/helpers.js +31 -0
- package/dist/editor/client/itemsRepository.js +255 -0
- package/dist/editor/client/operations.js +398 -0
- package/dist/editor/client/pageModelBuilder.js +129 -0
- package/dist/editor/commands/commands.js +2 -0
- package/dist/editor/commands/componentCommands.js +277 -0
- package/dist/editor/commands/createVersionCommand.js +26 -0
- package/dist/editor/commands/deleteVersionCommand.js +55 -0
- package/dist/editor/commands/itemCommands.js +134 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +94 -0
- package/dist/editor/commands/undo.js +32 -0
- package/dist/editor/component-designer/ComponentDesigner.js +58 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.js +9 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.js +67 -0
- package/dist/editor/component-designer/ComponentEditor.js +59 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.js +16 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.js +71 -0
- package/dist/editor/component-designer/ComponentsDropdown.js +22 -0
- package/dist/editor/component-designer/PlaceholdersEditor.js +70 -0
- package/dist/editor/component-designer/RenderingsDropdown.js +25 -0
- package/dist/editor/component-designer/TemplateEditor.js +144 -0
- package/dist/editor/component-designer/aiContext.js +18 -0
- package/dist/editor/componentTreeHelper.js +97 -0
- package/dist/editor/control-center/ControlCenterMenu.js +59 -0
- package/dist/editor/control-center/IndexOverview.js +27 -0
- package/dist/editor/control-center/IndexSettings.js +106 -0
- package/dist/editor/control-center/Status.js +7 -0
- package/dist/editor/editor-warnings/ItemLocked.js +40 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.js +16 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js +16 -0
- package/dist/editor/editor-warnings/NoWriteAccess.js +14 -0
- package/dist/editor/editor-warnings/ValidationErrors.js +27 -0
- package/dist/editor/field-types/AttachmentEditor.js +7 -0
- package/dist/editor/field-types/CheckboxEditor.js +32 -0
- package/dist/editor/field-types/DropLinkEditor.js +51 -0
- package/dist/editor/field-types/DropListEditor.js +58 -0
- package/dist/editor/field-types/ImageFieldEditor.js +36 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.js +64 -0
- package/dist/editor/field-types/LinkFieldEditor.js +58 -0
- package/dist/editor/field-types/MultiLineText.js +35 -0
- package/dist/editor/field-types/PictureFieldEditor.js +59 -0
- package/dist/editor/field-types/RawEditor.js +33 -0
- package/dist/editor/field-types/ReactQuill.js +366 -0
- package/dist/editor/field-types/RichTextEditor.js +46 -0
- package/dist/editor/field-types/RichTextEditorComponent.js +72 -0
- package/dist/editor/field-types/SingleLineText.js +92 -0
- package/dist/editor/field-types/TreeListEditor.js +137 -0
- package/dist/editor/fieldTypes.js +2 -0
- package/dist/editor/media-selector/AiImageSearch.js +110 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.js +58 -0
- package/dist/editor/media-selector/MediaSelector.js +11 -0
- package/dist/editor/media-selector/Preview.js +9 -0
- package/dist/editor/media-selector/Thumbnails.js +11 -0
- package/dist/editor/media-selector/TreeSelector.js +171 -0
- package/dist/editor/media-selector/UploadZone.js +80 -0
- package/dist/editor/menubar/ActionsMenu.js +33 -0
- package/dist/editor/menubar/ActiveUsers.js +13 -0
- package/dist/editor/menubar/ApproveAndPublish.js +13 -0
- package/dist/editor/menubar/BrowseHistory.js +14 -0
- package/dist/editor/menubar/ItemLanguageVersion.js +36 -0
- package/dist/editor/menubar/LanguageSelector.js +33 -0
- package/dist/editor/menubar/Menu.js +65 -0
- package/dist/editor/menubar/NavButtons.js +43 -0
- package/dist/editor/menubar/PageSelector.js +50 -0
- package/dist/editor/menubar/PageViewerControls.js +37 -0
- package/dist/editor/menubar/Separator.js +8 -0
- package/dist/editor/menubar/SiteInfo.js +26 -0
- package/dist/editor/menubar/User.js +18 -0
- package/dist/editor/menubar/VersionSelector.js +49 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +214 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.js +17 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js +27 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js +15 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.js +27 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.js +15 -0
- package/dist/editor/page-editor-chrome/FrameMenu.js +178 -0
- package/dist/editor/page-editor-chrome/FrameMenus.js +24 -0
- package/dist/editor/page-editor-chrome/InlineEditor.js +101 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.js +35 -0
- package/dist/editor/page-editor-chrome/NoLayout.js +21 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js +65 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +109 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +82 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +147 -0
- package/dist/editor/page-viewer/DeviceToolbar.js +21 -0
- package/dist/editor/page-viewer/EditorForm.js +130 -0
- package/dist/editor/page-viewer/MiniMap.js +257 -0
- package/dist/editor/page-viewer/PageViewer.js +64 -0
- package/dist/editor/page-viewer/PageViewerFrame.js +696 -0
- package/dist/editor/page-viewer/pageViewContext.js +117 -0
- package/dist/editor/pageModel.js +2 -0
- package/dist/editor/picture-shared.js +28 -0
- package/dist/editor/reviews/Comment.js +112 -0
- package/dist/editor/reviews/Comments.js +24 -0
- package/dist/editor/reviews/PreviewInfo.js +13 -0
- package/dist/editor/reviews/Reviews.js +165 -0
- package/dist/editor/reviews/reviewCommands.js +44 -0
- package/dist/editor/reviews/useReviews.js +48 -0
- package/dist/editor/services/aiService.js +99 -0
- package/dist/editor/services/componentDesignerService.js +79 -0
- package/dist/editor/services/contentService.js +104 -0
- package/dist/editor/services/editService.js +322 -0
- package/dist/editor/services/indexService.js +25 -0
- package/dist/editor/services/reviewsService.js +43 -0
- package/dist/editor/services/serviceHelper.js +67 -0
- package/dist/editor/services/systemService.js +7 -0
- package/dist/editor/services/translationService.js +15 -0
- package/dist/editor/services-server/api.js +119 -0
- package/dist/editor/services-server/graphQL.js +56 -0
- package/dist/editor/sidebar/ComponentPalette.js +55 -0
- package/dist/editor/sidebar/ComponentTree.js +362 -0
- package/dist/editor/sidebar/Debug.js +60 -0
- package/dist/editor/sidebar/DictionaryEditor.js +160 -0
- package/dist/editor/sidebar/EditHistory.js +74 -0
- package/dist/editor/sidebar/GraphQL.js +115 -0
- package/dist/editor/sidebar/Insert.js +24 -0
- package/dist/editor/sidebar/MainContentTree.js +52 -0
- package/dist/editor/sidebar/Performance.js +34 -0
- package/dist/editor/sidebar/Sessions.js +31 -0
- package/dist/editor/sidebar/Sidebar.js +15 -0
- package/dist/editor/sidebar/SidebarView.js +76 -0
- package/dist/editor/sidebar/Translations.js +160 -0
- package/dist/editor/sidebar/Validation.js +52 -0
- package/dist/editor/sidebar/ViewSelector.js +15 -0
- package/dist/editor/sidebar/Workbox.js +80 -0
- package/dist/editor/ui/CenteredMessage.js +7 -0
- package/dist/editor/ui/CopyToClipboardButton.js +17 -0
- package/dist/editor/ui/DialogButtons.js +7 -0
- package/dist/editor/ui/Icons.js +75 -0
- package/dist/editor/ui/ItemNameDialog.js +45 -0
- package/dist/editor/ui/ItemNameDialogNew.js +61 -0
- package/dist/editor/ui/ItemSearch.js +93 -0
- package/dist/editor/ui/PerfectTree.js +223 -0
- package/dist/editor/ui/Section.js +12 -0
- package/dist/editor/ui/SimpleIconButton.js +11 -0
- package/dist/editor/ui/SimpleMenu.js +9 -0
- package/dist/editor/ui/SimpleTable.js +11 -0
- package/dist/editor/ui/SimpleTabs.js +21 -0
- package/dist/editor/ui/SimpleToolbar.js +7 -0
- package/dist/editor/ui/Spinner.js +7 -0
- package/dist/editor/ui/Splitter.js +187 -0
- package/dist/editor/ui/StackedPanels.js +69 -0
- package/dist/editor/ui/Toolbar.js +7 -0
- package/dist/editor/utils/id-helper.js +7 -0
- package/dist/editor/utils/insertOptions.js +45 -0
- package/dist/editor/utils/itemutils.js +25 -0
- package/dist/editor/utils/useMemoDebug.js +20 -0
- package/dist/editor/utils.js +328 -0
- package/dist/editor/views/CompareView.js +147 -0
- package/dist/editor/views/EditView.js +17 -0
- package/dist/editor/views/ItemEditor.js +24 -0
- package/dist/editor/views/SingleEditView.js +25 -0
- package/dist/index.js +22 -0
- package/dist/page-wizard/PageWizard.js +62 -0
- package/dist/page-wizard/SelectWizard.js +43 -0
- package/dist/page-wizard/WizardSteps.js +71 -0
- package/dist/page-wizard/service.js +26 -0
- package/dist/page-wizard/startPageWizardCommand.js +23 -0
- package/dist/page-wizard/steps/BuildPageStep.js +138 -0
- package/dist/page-wizard/steps/CollectStep.js +124 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.js +211 -0
- package/dist/page-wizard/steps/Components.js +94 -0
- package/dist/page-wizard/steps/CreatePage.js +142 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.js +230 -0
- package/dist/page-wizard/steps/EditButton.js +7 -0
- package/dist/page-wizard/steps/FieldEditor.js +30 -0
- package/dist/page-wizard/steps/Generate.js +11 -0
- package/dist/page-wizard/steps/ImagesStep.js +159 -0
- package/dist/page-wizard/steps/LayoutStep.js +120 -0
- package/dist/page-wizard/steps/SelectStep.js +150 -0
- package/dist/page-wizard/steps/schema.js +140 -0
- package/dist/page-wizard/steps/usePageCreator.js +194 -0
- package/dist/splash-screen/NewPage.js +131 -0
- package/dist/splash-screen/SectionHeadline.js +9 -0
- package/dist/splash-screen/SplashScreen.js +81 -0
- package/dist/tour/Tour.js +321 -0
- package/dist/tour/default-tour.js +231 -0
- package/dist/tour/preview-tour.js +93 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types.js +2 -0
- package/package.json +1 -1
- package/src/editor/sidebar/ComponentTree.tsx +512 -512
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UploadZone = UploadZone;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const utils_1 = require("primereact/utils");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const react_2 = require("react");
|
|
8
|
+
const Spinner_1 = require("../ui/Spinner");
|
|
9
|
+
function UploadZone({ selectedFolderId, uploadCompleted, }) {
|
|
10
|
+
const [isDragging, setIsDragging] = (0, react_2.useState)(false);
|
|
11
|
+
const [isUploading, setIsUploading] = (0, react_2.useState)(false);
|
|
12
|
+
const dragZoneRef = (0, react_1.useRef)(null);
|
|
13
|
+
const handleDragOver = (0, react_1.useCallback)((e) => {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
}, []);
|
|
17
|
+
const handleDragEnter = (0, react_1.useCallback)((e) => {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
if (dragZoneRef.current === e.target) {
|
|
21
|
+
setIsDragging(true);
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
const handleDragLeave = (0, react_1.useCallback)((e) => {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
e.stopPropagation();
|
|
27
|
+
if (dragZoneRef.current?.contains(e.target)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setIsDragging(false);
|
|
31
|
+
}, []);
|
|
32
|
+
const handleDrop = (0, react_1.useCallback)((e) => {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
setIsDragging(false);
|
|
36
|
+
const files = Array.from(e.dataTransfer.files);
|
|
37
|
+
if (files.length > 0) {
|
|
38
|
+
onFilesDropped(files);
|
|
39
|
+
}
|
|
40
|
+
}, [selectedFolderId]);
|
|
41
|
+
const onFilesDropped = (0, react_1.useCallback)(async (files) => {
|
|
42
|
+
const formData = new FormData();
|
|
43
|
+
files.forEach((file, index) => {
|
|
44
|
+
formData.append("file" + index, file);
|
|
45
|
+
});
|
|
46
|
+
try {
|
|
47
|
+
setIsUploading(true);
|
|
48
|
+
const response = await fetch("/alpaca/editor/upload?folder=" + selectedFolderId, {
|
|
49
|
+
method: "POST",
|
|
50
|
+
body: formData,
|
|
51
|
+
});
|
|
52
|
+
setIsUploading(false);
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
throw new Error("Upload failed");
|
|
55
|
+
}
|
|
56
|
+
uploadCompleted();
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.error("Error uploading files:", error);
|
|
60
|
+
}
|
|
61
|
+
}, [selectedFolderId]);
|
|
62
|
+
if (isUploading) {
|
|
63
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "p-4 border-2 border-dashed rounded-lg items-center justify-center gap-2 text-gray-500 text-sm flex ", children: [(0, jsx_runtime_1.jsx)(Spinner_1.Spinner, { size: "2xl" }), " Uploading..."] }));
|
|
64
|
+
}
|
|
65
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { ref: dragZoneRef, className: (0, utils_1.classNames)("p-4 border-2 border-dashed rounded-lg flex flex-col items-center justify-center gap-2", isDragging
|
|
66
|
+
? "border-blue-400 bg-blue-50"
|
|
67
|
+
: "border-gray-300 hover:border-blue-300 hover:bg-gray-50"), onDragOverCapture: handleDragOver, onDragEnterCapture: handleDragEnter, onDragLeaveCapture: handleDragLeave, onDropCapture: handleDrop, onClick: () => {
|
|
68
|
+
const fileInput = document.createElement("input");
|
|
69
|
+
fileInput.type = "file";
|
|
70
|
+
fileInput.multiple = true;
|
|
71
|
+
fileInput.accept = "image/*,video/*";
|
|
72
|
+
fileInput.onchange = (e) => {
|
|
73
|
+
const files = Array.from(e.target.files || []);
|
|
74
|
+
if (files.length > 0) {
|
|
75
|
+
onFilesDropped(files);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
fileInput.click();
|
|
79
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("i", { className: "pi pi-upload text-gray-400" }), (0, jsx_runtime_1.jsx)("span", { className: "text-gray-600", children: isDragging ? "Drop files here" : "Drag and drop files here" })] }) }), isDragging && ((0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 border-2 border-dashed border-blue-400 pointer-events-none" }))] }));
|
|
80
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionsMenu = ActionsMenu;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const overlaypanel_1 = require("primereact/overlaypanel");
|
|
8
|
+
const menu_1 = require("primereact/menu");
|
|
9
|
+
function ActionsMenu() {
|
|
10
|
+
const overlaypanel = (0, react_1.useRef)(null);
|
|
11
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
12
|
+
if (!editContext)
|
|
13
|
+
return null;
|
|
14
|
+
const items = editContext.configuration.editor.actionsMenu?.itemsFactory(editContext);
|
|
15
|
+
// Enhance each item to call overlaypanel.hide() after executing its original command
|
|
16
|
+
const enhancedItems = items?.map((item) => {
|
|
17
|
+
// Preserve the original command if present
|
|
18
|
+
const originalCommand = item.command;
|
|
19
|
+
return {
|
|
20
|
+
...item,
|
|
21
|
+
command: (e) => {
|
|
22
|
+
if (originalCommand) {
|
|
23
|
+
originalCommand(e);
|
|
24
|
+
}
|
|
25
|
+
// Close the overlay panel
|
|
26
|
+
overlaypanel.current?.hide();
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { id: "actions-menu", className: "flex gap-2 items-center bg-blue-500 text-white px-4 h-12 hover:bg-blue-600 cursor-pointer ml-2", onClick: async (ev) => {
|
|
31
|
+
overlaypanel.current.toggle(ev);
|
|
32
|
+
}, children: (0, jsx_runtime_1.jsx)("i", { className: "pi pi-sort-down-fill" }) }), (0, jsx_runtime_1.jsx)(overlaypanel_1.OverlayPanel, { dismissable: true, ref: overlaypanel, closeOnEscape: true, children: (0, jsx_runtime_1.jsx)(menu_1.Menu, { model: enhancedItems }) })] }));
|
|
33
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActiveUsers = ActiveUsers;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const User_1 = require("./User");
|
|
7
|
+
function ActiveUsers() {
|
|
8
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
9
|
+
const mySession = editContext?.activeSessions.find((x) => x.sessionId === editContext?.sessionId);
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "border-gray-200 flex gap-2 items-center", children: editContext?.activeSessions
|
|
11
|
+
.filter((x) => x.item?.id === mySession?.item?.id)
|
|
12
|
+
.map((s) => (0, jsx_runtime_1.jsx)(User_1.User, { session: s }, s.sessionId)) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApproveAndPublishButton = ApproveAndPublishButton;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
function ApproveAndPublishButton() {
|
|
7
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "bg-alpaca-blue hover:bg-alpaca-blue-light text-white p-4 cursor-pointer text-sm rounded-l-full", onClick: () => {
|
|
9
|
+
const workboxView = editContext?.configuration.editor.views.find((x) => x.name == "workbox");
|
|
10
|
+
if (workboxView)
|
|
11
|
+
editContext?.switchView(workboxView.name);
|
|
12
|
+
}, children: "Approve & Publish" }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowseHistory = BrowseHistory;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
function BrowseHistory({ setHoveredItem, itemSelected, }) {
|
|
7
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
8
|
+
if (!editContext)
|
|
9
|
+
return;
|
|
10
|
+
const history = editContext.browseHistory;
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "overflow-y-auto flex flex-col gap-1 flex-1", children: history
|
|
12
|
+
.filter((x, i) => x.language && i < 7)
|
|
13
|
+
.map((x) => ((0, jsx_runtime_1.jsxs)("div", { className: "text-xs cursor-pointer hover:text-gray-400 flex gap-1", onMouseEnter: () => setHoveredItem(x), onMouseLeave: () => setHoveredItem(undefined), onClick: () => itemSelected(x), children: [x.icon && (0, jsx_runtime_1.jsx)("img", { src: x.icon, width: "16", height: "16" }), " ", x.path, " ", (0, jsx_runtime_1.jsxs)("span", { className: "text-500", children: ["(", x.language, ")"] })] }, x.id + x.language))) }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ItemLanguageVersion = ItemLanguageVersion;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
//import { BrowseHistory } from "./BrowseHistory";
|
|
7
|
+
const LanguageSelector_1 = require("./LanguageSelector");
|
|
8
|
+
const PageSelector_1 = require("./PageSelector");
|
|
9
|
+
const Separator_1 = require("./Separator");
|
|
10
|
+
const VersionSelector_1 = require("./VersionSelector");
|
|
11
|
+
const NavButtons_1 = require("./NavButtons");
|
|
12
|
+
const utils_1 = require("../utils");
|
|
13
|
+
const itemutils_1 = require("../utils/itemutils");
|
|
14
|
+
function ItemLanguageVersion() {
|
|
15
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
16
|
+
if (!editContext)
|
|
17
|
+
return;
|
|
18
|
+
const item = editContext.currentItemDescriptor;
|
|
19
|
+
if (!item)
|
|
20
|
+
return;
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1 items-center", children: [(0, jsx_runtime_1.jsx)(PageSelector_1.PageSelector, { itemDescriptor: item }), (0, jsx_runtime_1.jsx)(Separator_1.Separator, {}), (0, jsx_runtime_1.jsx)(LanguageSelector_1.LanguageSelector, { showAllLanguagesSwitch: true, selectedLanguage: item.language, onLanguageSelected: (language) => {
|
|
22
|
+
if (!language.versions) {
|
|
23
|
+
if (editContext) {
|
|
24
|
+
(0, itemutils_1.confirmCreateVersion)(editContext, language);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else
|
|
28
|
+
editContext?.loadItem({
|
|
29
|
+
...(0, utils_1.getItemDescriptor)(item),
|
|
30
|
+
language: language.languageCode,
|
|
31
|
+
version: 0,
|
|
32
|
+
});
|
|
33
|
+
} }), (0, jsx_runtime_1.jsx)(Separator_1.Separator, {}), (0, jsx_runtime_1.jsx)(VersionSelector_1.VersionSelector, { itemDescriptor: item, versions: editContext.itemVersions, actualVersion: editContext.contentEditorItem?.version, onVersionSelected: (version) => {
|
|
34
|
+
editContext.loadItem({ ...item, version });
|
|
35
|
+
} }), (0, jsx_runtime_1.jsx)(Separator_1.Separator, {}), (0, jsx_runtime_1.jsx)(NavButtons_1.NavButtons, {})] }));
|
|
36
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.LanguageSelector = LanguageSelector;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const Icons_1 = require("../ui/Icons");
|
|
7
|
+
const overlaypanel_1 = require("primereact/overlaypanel");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const inputswitch_1 = require("primereact/inputswitch");
|
|
10
|
+
const editContext_1 = require("../client/editContext");
|
|
11
|
+
function LanguageSelector({ selectedLanguage, darkMode, onLanguageSelected, showAllLanguagesSwitch, showAllLanguages = false, disabled = false, }) {
|
|
12
|
+
const overlaypanel = (0, react_1.useRef)(null);
|
|
13
|
+
const [showAllLanguagesInternal, setShowAllLanguagesInternal] = (0, react_1.useState)(showAllLanguages);
|
|
14
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
15
|
+
const allLanguages = editContext?.itemLanguages || [];
|
|
16
|
+
const currentLanguage = allLanguages.find((x) => x.languageCode === selectedLanguage);
|
|
17
|
+
const languages = showAllLanguagesInternal
|
|
18
|
+
? allLanguages
|
|
19
|
+
: allLanguages.filter((x) => x.versions > 0);
|
|
20
|
+
languages.sort((a, b) => a.name.localeCompare(b.name));
|
|
21
|
+
const selectLanguage = async (language) => {
|
|
22
|
+
onLanguageSelected(language);
|
|
23
|
+
overlaypanel.current?.hide();
|
|
24
|
+
return;
|
|
25
|
+
};
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: `p-[7px] text-sm cursor-pointer flex items-center gap-3 ${darkMode
|
|
27
|
+
? "text-gray-500 hover:bg-gray-300"
|
|
28
|
+
: "text-gray-200 hover:bg-gray-500"} rounded-md ${disabled ? "opacity-50" : ""}`, onClick: (ev) => {
|
|
29
|
+
if (disabled)
|
|
30
|
+
return;
|
|
31
|
+
overlaypanel.current?.toggle(ev, ev.currentTarget);
|
|
32
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [currentLanguage && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: currentLanguage.icon, className: "h-5" }), " ", currentLanguage.name] })), !currentLanguage && (0, jsx_runtime_1.jsx)("div", { children: "Select language" })] }), (0, jsx_runtime_1.jsx)("div", { className: `p-dropdown-trigger ${darkMode ? "text-gray-500" : "text-gray-200"}`, role: "button", "aria-haspopup": "listbox", "aria-expanded": "false", "aria-label": "Select a language", "data-pc-section": "trigger", children: (0, jsx_runtime_1.jsx)(Icons_1.ArrowDownIcon, {}) })] }), (0, jsx_runtime_1.jsx)(overlaypanel_1.OverlayPanel, { dismissable: true, ref: overlaypanel, closeOnEscape: true, children: (0, jsx_runtime_1.jsxs)("div", { className: "max-h-[50vh] min-w-64 flex flex-col", children: [showAllLanguagesSwitch && ((0, jsx_runtime_1.jsxs)("div", { className: "text-xs p-2 flex items-center gap-2 justify-center", children: [(0, jsx_runtime_1.jsx)("span", { className: "cursor-pointer", onClick: () => setShowAllLanguagesInternal(false), children: "Item languages" }), (0, jsx_runtime_1.jsx)(inputswitch_1.InputSwitch, { checked: showAllLanguagesInternal, onChange: (e) => setShowAllLanguagesInternal(e.value) }), (0, jsx_runtime_1.jsx)("span", { className: "cursor-pointer", onClick: () => setShowAllLanguagesInternal(true), children: "All languages" })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 overflow-y-auto", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex flex-col text-sm", children: languages.map((x) => ((0, jsx_runtime_1.jsxs)("div", { className: "cursor-pointer hover:bg-gray-200 flex gap-2 p-2", onClick: () => selectLanguage(x), children: [(0, jsx_runtime_1.jsx)("img", { src: x.icon, className: "h-5" }), " ", x.name, " (", x.versions, ")"] }, x.languageCode))) }), languages.length === 0 && ((0, jsx_runtime_1.jsx)("div", { className: "p-2 text-gray-500", children: "This item has no languages" }))] })] }) })] }));
|
|
33
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Menu = Menu;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const menubar_1 = require("primereact/menubar");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
const ItemLanguageVersion_1 = require("./ItemLanguageVersion");
|
|
8
|
+
const config_1 = require("../../config/config");
|
|
9
|
+
const PageViewerControls_1 = require("./PageViewerControls");
|
|
10
|
+
const ApproveAndPublish_1 = require("./ApproveAndPublish");
|
|
11
|
+
function Menu() {
|
|
12
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
13
|
+
if (!editContext)
|
|
14
|
+
return;
|
|
15
|
+
const configuration = (0, config_1.getConfiguration)();
|
|
16
|
+
if (!configuration.editor.mainNavigation)
|
|
17
|
+
return null;
|
|
18
|
+
const getSubItems = (items) => {
|
|
19
|
+
if (typeof items === "function")
|
|
20
|
+
items = items(editContext);
|
|
21
|
+
return items.map((y) => {
|
|
22
|
+
if ("execute" in y)
|
|
23
|
+
return {
|
|
24
|
+
id: y.id,
|
|
25
|
+
label: y.label,
|
|
26
|
+
icon: y.icon,
|
|
27
|
+
disabled: editContext.isCommandDisabled({ command: y }),
|
|
28
|
+
command: async (event) => {
|
|
29
|
+
await editContext.executeCommand({
|
|
30
|
+
command: y,
|
|
31
|
+
event: event.originalEvent,
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
id: y.id,
|
|
37
|
+
label: y.label,
|
|
38
|
+
icon: y.icon,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const menuItems = configuration.editor.mainNavigation.map((x) => {
|
|
43
|
+
if ("execute" in x)
|
|
44
|
+
return {
|
|
45
|
+
id: x.id,
|
|
46
|
+
label: x.label,
|
|
47
|
+
icon: x.icon,
|
|
48
|
+
disabled: editContext.isCommandDisabled({ command: x }),
|
|
49
|
+
command: async (event) => {
|
|
50
|
+
await editContext.executeCommand({
|
|
51
|
+
command: x,
|
|
52
|
+
event: event.originalEvent,
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
id: x.id,
|
|
58
|
+
label: x.label,
|
|
59
|
+
icon: x.icon,
|
|
60
|
+
items: x.items ? getSubItems(x.items) : undefined,
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
const endContent = ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-3 items-center", children: [(0, jsx_runtime_1.jsx)(PageViewerControls_1.PageViewerControls, {}), (0, jsx_runtime_1.jsx)(ItemLanguageVersion_1.ItemLanguageVersion, {}), (0, jsx_runtime_1.jsx)(ApproveAndPublish_1.ApproveAndPublishButton, {})] }));
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(menubar_1.Menubar, { model: menuItems, end: endContent, className: "p-0 text-sm rounded-none border-0 border-b bg-gray-50 shadow-bottom-soft z-10 min-h-12" }));
|
|
65
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavButtons = NavButtons;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const utils_1 = require("primereact/utils");
|
|
7
|
+
function NavButtons() {
|
|
8
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
9
|
+
if (!editContext)
|
|
10
|
+
return;
|
|
11
|
+
const item = editContext.contentEditorItem;
|
|
12
|
+
if (!item)
|
|
13
|
+
return;
|
|
14
|
+
const history = editContext.browseHistory;
|
|
15
|
+
const currentIndex = history.findIndex((x) => x.id === item.id && x.language === item.language);
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.classNames)(currentIndex < history.length - 1
|
|
17
|
+
? " text-gray-200"
|
|
18
|
+
: "text-gray-400", "cursor-pointer hover:bg-gray-500 flex gap-2 p-2 rounded-md "), onClick: () => {
|
|
19
|
+
const currentIndex = history.findIndex((x) => x.id === item.id && x.language === item.language);
|
|
20
|
+
if (currentIndex < history.length - 1) {
|
|
21
|
+
const historyItem = history[currentIndex + 1];
|
|
22
|
+
if (!historyItem)
|
|
23
|
+
return;
|
|
24
|
+
editContext.loadItem({
|
|
25
|
+
id: historyItem.id,
|
|
26
|
+
language: historyItem.language,
|
|
27
|
+
version: historyItem.version || 0,
|
|
28
|
+
}, { addToBrowseHistory: false });
|
|
29
|
+
}
|
|
30
|
+
}, children: (0, jsx_runtime_1.jsx)("i", { className: "pi pi-chevron-left text-sm" }) }, "nav-fwd"), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.classNames)(currentIndex > 0 ? " text-gray-200" : "text-gray-400", "cursor-pointer hover:bg-gray-500 flex gap-2 p-2 rounded-md "), onClick: () => {
|
|
31
|
+
const currentIndex = history.findIndex((x) => x.id === item.id && x.language === item.language);
|
|
32
|
+
if (currentIndex > 0) {
|
|
33
|
+
const historyItem = history[currentIndex - 1];
|
|
34
|
+
if (!historyItem)
|
|
35
|
+
return;
|
|
36
|
+
editContext.loadItem({
|
|
37
|
+
id: historyItem.id,
|
|
38
|
+
language: historyItem.language,
|
|
39
|
+
version: historyItem.version || 0,
|
|
40
|
+
}, { addToBrowseHistory: false });
|
|
41
|
+
}
|
|
42
|
+
}, children: (0, jsx_runtime_1.jsx)("i", { className: "pi pi-chevron-right text-sm" }) }, "nav-back")] }));
|
|
43
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageSelector = PageSelector;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const overlaypanel_1 = require("primereact/overlaypanel");
|
|
7
|
+
const editContext_1 = require("../client/editContext");
|
|
8
|
+
const BrowseHistory_1 = require("./BrowseHistory");
|
|
9
|
+
const Icons_1 = require("../ui/Icons");
|
|
10
|
+
const button_1 = require("primereact/button");
|
|
11
|
+
const ItemSearch_1 = require("../ui/ItemSearch");
|
|
12
|
+
const ScrollingContentTree_1 = require("../ScrollingContentTree");
|
|
13
|
+
function PageSelector({ itemDescriptor, }) {
|
|
14
|
+
const overlaypanel = (0, react_1.useRef)(null);
|
|
15
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
16
|
+
const [item, setItem] = (0, react_1.useState)();
|
|
17
|
+
const [hoveredItem, setHoveredItem] = (0, react_1.useState)();
|
|
18
|
+
const loadItem = (selectedItem) => {
|
|
19
|
+
if (Array.isArray(selectedItem) && selectedItem[0]) {
|
|
20
|
+
selectedItem = selectedItem[0];
|
|
21
|
+
}
|
|
22
|
+
if (!selectedItem)
|
|
23
|
+
return;
|
|
24
|
+
const itemDescriptor = selectedItem;
|
|
25
|
+
editContext?.loadItem({
|
|
26
|
+
id: itemDescriptor.id,
|
|
27
|
+
language: itemDescriptor.language,
|
|
28
|
+
version: 0,
|
|
29
|
+
});
|
|
30
|
+
overlaypanel.current?.hide();
|
|
31
|
+
};
|
|
32
|
+
(0, react_1.useEffect)(() => {
|
|
33
|
+
const setName = async () => {
|
|
34
|
+
if (!itemDescriptor)
|
|
35
|
+
return;
|
|
36
|
+
const item = await editContext?.itemsRepository.getItem(itemDescriptor);
|
|
37
|
+
setItem(item);
|
|
38
|
+
};
|
|
39
|
+
setName();
|
|
40
|
+
}, [itemDescriptor]);
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { id: "page-selector-button", className: "p-[7px] text-sm cursor-pointer flex items-center gap-3 text-gray-200 hover:bg-gray-500 rounded-md", onClick: (ev) => overlaypanel.current?.toggle(ev, ev.currentTarget), "data-testid": "page-selector-button", children: [item?.name || "unknown", (0, jsx_runtime_1.jsx)("div", { className: "p-dropdown-trigger", role: "button", "aria-haspopup": "listbox", "aria-expanded": "false", "aria-label": "Select a page", "data-pc-section": "trigger", children: (0, jsx_runtime_1.jsx)(Icons_1.ArrowDownIcon, {}) })] }), (0, jsx_runtime_1.jsx)(overlaypanel_1.OverlayPanel, { dismissable: true, ref: overlaypanel, closeOnEscape: true, children: (0, jsx_runtime_1.jsxs)("div", { className: "h-[75vh] min-w-48 flex flex-col overflow-hidden", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-1 flex flex-col gap-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-2 flex flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-gray-500 mb-2 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(Icons_1.ArrowDownIcon, {}), " Search"] }), (0, jsx_runtime_1.jsx)(ItemSearch_1.ItemSearch, { autoFocus: true, setHoveredItem: setHoveredItem, itemSelected: (item) => loadItem(item) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 flex flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "border-t p-2 pb-1 text-xs text-gray-500 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(Icons_1.ArrowDownIcon, {}), " Select"] }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex-1", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 overflow-auto", children: (0, jsx_runtime_1.jsx)(ScrollingContentTree_1.ScrollingContentTree, { selectedItemId: hoveredItem?.id ?? item?.id, onSelectionChange: loadItem }) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-t p-2 flex flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-gray-500 mb-2 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(Icons_1.ArrowDownIcon, {}), " Last visited"] }), (0, jsx_runtime_1.jsx)(BrowseHistory_1.BrowseHistory, { setHoveredItem: setHoveredItem, itemSelected: (item) => loadItem(item) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-t p-2 flex flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-gray-500 mb-2 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(Icons_1.ArrowDownIcon, {}), " Actions"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { size: "small", icon: "pi pi-plus", label: "New Page", onClick: () => editContext?.openCreatePageDialog() }), (0, jsx_runtime_1.jsx)(button_1.Button, { id: "delete-page-button", severity: "danger", size: "small", icon: "pi pi-times", label: "Delete", onClick: async (ev) => {
|
|
42
|
+
if (item &&
|
|
43
|
+
(await editContext?.executeCommand({
|
|
44
|
+
command: editContext?.configuration.commands.deleteItem,
|
|
45
|
+
event: ev,
|
|
46
|
+
data: { items: [item] },
|
|
47
|
+
})))
|
|
48
|
+
editContext?.openSplashScreen();
|
|
49
|
+
} })] })] })] }) })] }));
|
|
50
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageViewerControls = PageViewerControls;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const utils_1 = require("primereact/utils");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
const Separator_1 = require("./Separator");
|
|
8
|
+
const Icons_1 = require("../ui/Icons");
|
|
9
|
+
const SimpleIconButton_1 = require("../ui/SimpleIconButton");
|
|
10
|
+
function PageViewerControls() {
|
|
11
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
12
|
+
if (!editContext)
|
|
13
|
+
return null;
|
|
14
|
+
const hasLayout = editContext.contentEditorItem?.hasLayout;
|
|
15
|
+
const pageViewContext = editContext.pageView;
|
|
16
|
+
const device = pageViewContext.device;
|
|
17
|
+
const setDevice = pageViewContext.setDevice;
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-center", children: [hasLayout && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [" ", (0, jsx_runtime_1.jsx)("i", { className: (0, utils_1.classNames)(device === "desktop"
|
|
19
|
+
? "bg-gray-200"
|
|
20
|
+
: " hover:bg-gray-200 text-gray-100 hover:text-gray-800", "pi pi-desktop cursor-pointer p-2 rounded-full"), title: "Desktop", onClick: () => {
|
|
21
|
+
setDevice("desktop");
|
|
22
|
+
} }), (0, jsx_runtime_1.jsx)("i", { className: (0, utils_1.classNames)(device && device !== "desktop"
|
|
23
|
+
? "bg-gray-200"
|
|
24
|
+
: " hover:bg-gray-200 text-gray-100 hover:text-gray-800", "pi pi-mobile cursor-pointer p-2 rounded-full"), title: "Mobile", onClick: () => {
|
|
25
|
+
if (editContext.configuration.devices[0]) {
|
|
26
|
+
setDevice(editContext.configuration.devices[0].name);
|
|
27
|
+
}
|
|
28
|
+
} }), (0, jsx_runtime_1.jsx)("i", { className: (0, utils_1.classNames)(!device
|
|
29
|
+
? "bg-gray-200"
|
|
30
|
+
: " hover:bg-gray-200 text-gray-100 hover:text-gray-800", "w-8 h-8 cursor-pointer p-1 rounded-full"), title: "Form", onClick: () => {
|
|
31
|
+
setDevice("");
|
|
32
|
+
}, children: (0, jsx_runtime_1.jsx)(Icons_1.FormEditIcon, {}) }), (0, jsx_runtime_1.jsx)(Separator_1.Separator, { size: "large" }), (0, jsx_runtime_1.jsx)("i", { className: "pi pi-external-link cursor-pointer hover:bg-gray-200 p-2 rounded-full text-gray-100 hover:text-gray-800", title: "Fullscreen", onClick: () => pageViewContext.setFullscreen(true) }), !editContext.user?.isLimitedPreviewUser && ((0, jsx_runtime_1.jsx)("i", { className: (0, utils_1.classNames)(editContext.previewMode
|
|
33
|
+
? "bg-gray-200"
|
|
34
|
+
: " hover:bg-gray-200 text-gray-100 hover:text-gray-800", "pi pi-eye cursor-pointer p-2 rounded-full"), title: "Preview", onClick: () => editContext.setPreviewMode((x) => !x) })), (0, jsx_runtime_1.jsx)(Separator_1.Separator, { size: "large" })] })), (0, jsx_runtime_1.jsx)(SimpleIconButton_1.SimpleIconButton, { icon: (0, jsx_runtime_1.jsx)(Icons_1.CompareIcon, { className: "w-6 h-6 p-1" }), label: "Compare", size: "large", className: editContext.compareMode
|
|
35
|
+
? "text-gray-600"
|
|
36
|
+
: "text-gray-100 hover:text-gray-600", selected: editContext.compareMode, onClick: () => editContext.setCompareMode(!editContext.compareMode) })] }));
|
|
37
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Separator = Separator;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const utils_1 = require("primereact/utils");
|
|
6
|
+
function Separator({ size }) {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.classNames)("border-r border-gray-300", size === "large" ? "h-7 mx-2" : "h-4 mx-1") }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SiteInfo = SiteInfo;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const overlaypanel_1 = require("primereact/overlaypanel");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const contentService_1 = require("../services/contentService");
|
|
9
|
+
const progressspinner_1 = require("primereact/progressspinner");
|
|
10
|
+
function SiteInfo() {
|
|
11
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
12
|
+
const overlaypanel = (0, react_1.useRef)(null);
|
|
13
|
+
const [sites, setSites] = (0, react_1.useState)();
|
|
14
|
+
if (!editContext)
|
|
15
|
+
return null;
|
|
16
|
+
const loadSites = async () => {
|
|
17
|
+
const sites = await (0, contentService_1.getSites)();
|
|
18
|
+
if (sites.data)
|
|
19
|
+
setSites(sites.data);
|
|
20
|
+
};
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "my-2 flex gap-2 items-center text-gray-200 cursor-pointer", title: editContext.pageView.site?.name, onClick: async (ev) => {
|
|
22
|
+
setSites(undefined);
|
|
23
|
+
overlaypanel.current.toggle(ev);
|
|
24
|
+
await loadSites();
|
|
25
|
+
}, children: [(0, jsx_runtime_1.jsx)("i", { className: "pi pi-globe text-lg" }), (0, jsx_runtime_1.jsx)(overlaypanel_1.OverlayPanel, { dismissable: true, ref: overlaypanel, closeOnEscape: true, children: (0, jsx_runtime_1.jsx)("div", { className: "max-h-[45vh] min-w-20 flex flex-col overflow-hidden text-xs", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-4", children: ["This page is part of the site:", " ", (0, jsx_runtime_1.jsx)("span", { className: "font-bold", children: editContext.pageView.site?.name }), !sites && (0, jsx_runtime_1.jsx)(progressspinner_1.ProgressSpinner, { className: "w-5 h-5" }), sites && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "border-b my-2", children: "Sites registered:" }), (0, jsx_runtime_1.jsx)("ul", { children: sites.map((site) => ((0, jsx_runtime_1.jsx)("li", { children: site.name }, site.name))) })] }))] }) }) })] }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.User = User;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
function User({ session }) {
|
|
7
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
8
|
+
if (!editContext)
|
|
9
|
+
return;
|
|
10
|
+
const userName = session.user.displayName || session.user.name;
|
|
11
|
+
const idxBackslash = userName.indexOf("\\");
|
|
12
|
+
const letter = idxBackslash >= 0
|
|
13
|
+
? userName[idxBackslash + 1]
|
|
14
|
+
: userName[0]
|
|
15
|
+
? userName[0].toUpperCase()
|
|
16
|
+
: "";
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "rounded-full w-8 h-8 grid items-center justify-center text-white", style: { background: session.color }, title: userName + " (" + session.user.email + ")", children: letter }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.VersionSelector = VersionSelector;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const Icons_1 = require("../ui/Icons");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const overlaypanel_1 = require("primereact/overlaypanel");
|
|
9
|
+
const button_1 = require("primereact/button");
|
|
10
|
+
const editContext_1 = require("../client/editContext");
|
|
11
|
+
const createVersionCommand_1 = require("../commands/createVersionCommand");
|
|
12
|
+
const deleteVersionCommand_1 = require("../commands/deleteVersionCommand");
|
|
13
|
+
function VersionSelector({ itemDescriptor, actualVersion, onVersionSelected, readOnly, darkMode, versions, }) {
|
|
14
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
15
|
+
const overlaypanel = (0, react_1.useRef)(null);
|
|
16
|
+
if (itemDescriptor == null)
|
|
17
|
+
return;
|
|
18
|
+
const getVersionLabel = () => {
|
|
19
|
+
if (versions.length === 0)
|
|
20
|
+
return "No versions";
|
|
21
|
+
if (itemDescriptor.version === 0)
|
|
22
|
+
return "Latest" + (actualVersion ? " (" + actualVersion + ")" : "");
|
|
23
|
+
return itemDescriptor.version;
|
|
24
|
+
};
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: `p-[7px] text-sm cursor-pointer flex items-center gap-3 ${darkMode
|
|
26
|
+
? "text-gray-500 hover:bg-gray-200"
|
|
27
|
+
: "text-gray-200 hover:bg-gray-500"} rounded-md a`, onClick: (ev) => overlaypanel.current?.toggle(ev, ev.currentTarget), children: [(0, jsx_runtime_1.jsx)("div", { className: "flex gap-2", children: getVersionLabel() }), (0, jsx_runtime_1.jsx)("div", { className: `p-dropdown-trigger ${darkMode ? "text-gray-500" : "text-gray-200"}`, role: "button", "aria-haspopup": "listbox", "aria-expanded": "false", "aria-label": "Select a version", "data-pc-section": "trigger", children: (0, jsx_runtime_1.jsx)(Icons_1.ArrowDownIcon, {}) })] }), (0, jsx_runtime_1.jsxs)(overlaypanel_1.OverlayPanel, { dismissable: true, ref: overlaypanel, closeOnEscape: true, children: [(0, jsx_runtime_1.jsx)("div", { className: "max-h-[50vh] min-w-20 flex flex-col", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1 overflow-auto", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col text-sm", children: [versions.length === 0 && ((0, jsx_runtime_1.jsx)("div", { className: "p-2", children: "No versions" })), versions.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "cursor-pointer hover:bg-gray-200 flex gap-2 p-2", onClick: () => {
|
|
28
|
+
onVersionSelected(0);
|
|
29
|
+
overlaypanel.current?.hide();
|
|
30
|
+
}, children: "Latest" }, "latest")), versions.map((x) => ((0, jsx_runtime_1.jsxs)("div", { className: "cursor-pointer hover:bg-gray-200 flex gap-2 p-2", onClick: () => {
|
|
31
|
+
onVersionSelected(x.version);
|
|
32
|
+
overlaypanel.current?.hide();
|
|
33
|
+
}, children: [itemDescriptor.version === x.version && ((0, jsx_runtime_1.jsx)("i", { className: "pi pi-check", style: { fontSize: "1rem" } })), " ", x.version] }, x.version)))] }) }) }), !readOnly && ((0, jsx_runtime_1.jsxs)("div", { className: "border-t p-2 flex flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-gray-500 mb-2 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(Icons_1.ArrowDownIcon, {}), " Actions"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { text: true, size: "small", icon: "pi pi-plus", label: "Add Version", onClick: async (ev) => {
|
|
34
|
+
await editContext?.executeCommand({
|
|
35
|
+
command: (0, createVersionCommand_1.getCreateAndSwitchToNewVersionCommand)({}),
|
|
36
|
+
event: ev,
|
|
37
|
+
});
|
|
38
|
+
overlaypanel.current?.hide();
|
|
39
|
+
onVersionSelected(0);
|
|
40
|
+
} }), (0, jsx_runtime_1.jsx)(button_1.Button, { text: true, size: "small", icon: "pi pi-times", label: "Delete Version", severity: "danger", disabled: versions.length === 0, onClick: async (ev) => {
|
|
41
|
+
editContext;
|
|
42
|
+
await editContext?.executeCommand({
|
|
43
|
+
command: (0, deleteVersionCommand_1.getDeleteVersionCommand)({}),
|
|
44
|
+
event: ev,
|
|
45
|
+
});
|
|
46
|
+
overlaypanel.current?.hide();
|
|
47
|
+
onVersionSelected(0);
|
|
48
|
+
} }), " "] })] }))] })] }));
|
|
49
|
+
}
|