@alpaca-editor/core 1.0.3847 → 1.0.3849
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/editor/ComponentInfo.js +14 -2
- package/dist/editor/ComponentInfo.js.map +1 -1
- package/dist/editor/ContentTree.js +0 -4
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/ContextMenu.d.ts +1 -1
- package/dist/editor/ContextMenu.js +4 -4
- package/dist/editor/ContextMenu.js.map +1 -1
- package/dist/editor/client/EditorClient.js +34 -30
- package/dist/editor/client/EditorClient.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +1 -1
- package/dist/editor/client/itemsRepository.d.ts +2 -1
- package/dist/editor/client/itemsRepository.js +142 -40
- package/dist/editor/client/itemsRepository.js.map +1 -1
- package/dist/editor/client/pageModelBuilder.js +1 -1
- package/dist/editor/client/pageModelBuilder.js.map +1 -1
- package/dist/editor/commands/componentCommands.d.ts +1 -2
- package/dist/editor/commands/componentCommands.js +39 -35
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js +9 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +27 -23
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js.map +1 -1
- package/dist/editor/page-viewer/EditorForm.js +18 -8
- package/dist/editor/page-viewer/EditorForm.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +3 -2
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/pageModel.d.ts +8 -1
- package/dist/editor/services/contentService.d.ts +2 -1
- package/dist/editor/services/contentService.js +5 -0
- package/dist/editor/services/contentService.js.map +1 -1
- package/dist/editor/sidebar/ComponentTree.js +2 -2
- package/dist/editor/sidebar/ComponentTree.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/package.json +1 -1
- package/src/editor/ComponentInfo.tsx +17 -2
- package/src/editor/ContentTree.tsx +0 -4
- package/src/editor/ContextMenu.tsx +5 -5
- package/src/editor/client/EditorClient.tsx +38 -35
- package/src/editor/client/editContext.ts +1 -1
- package/src/editor/client/itemsRepository.ts +205 -77
- package/src/editor/client/pageModelBuilder.ts +1 -1
- package/src/editor/commands/componentCommands.tsx +51 -53
- package/src/editor/page-editor-chrome/FrameMenu.tsx +14 -2
- package/src/editor/page-editor-chrome/PictureEditorOverlay.tsx +41 -34
- package/src/editor/page-viewer/EditorForm.tsx +22 -10
- package/src/editor/page-viewer/PageViewerFrame.tsx +7 -9
- package/src/editor/pageModel.ts +9 -1
- package/src/editor/services/contentService.ts +15 -6
- package/src/editor/sidebar/ComponentTree.tsx +2 -2
- package/src/revision.ts +2 -2
|
@@ -42,43 +42,43 @@ export type ComponentCommand = Command<ComponentCommandData> & {
|
|
|
42
42
|
const isPlaceholder = (x: any): x is Placeholder => x.components !== undefined;
|
|
43
43
|
const defaultIconSize = 16;
|
|
44
44
|
|
|
45
|
-
export function getSelectedComponentCommands(editContext: EditContextType) {
|
|
46
|
-
|
|
45
|
+
// export function getSelectedComponentCommands(editContext: EditContextType) {
|
|
46
|
+
// const selection = editContext.selection;
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
// const selectedComponents = selection
|
|
49
|
+
// .map((x) => getComponentById(x, editContext.page!))
|
|
50
|
+
// .filter((x) => x) as Component[];
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
// const componentCommands = getComponentCommands(
|
|
53
|
+
// selectedComponents,
|
|
54
|
+
// editContext,
|
|
55
|
+
// );
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
// const componentCommandMenuItems = componentCommands.filter(
|
|
58
|
+
// (x) => x.visibilityScopes.indexOf("menu") >= 0,
|
|
59
|
+
// );
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
}
|
|
61
|
+
// return componentCommandMenuItems;
|
|
62
|
+
// }
|
|
63
63
|
|
|
64
|
-
export function getComponentCommands(
|
|
64
|
+
export async function getComponentCommands(
|
|
65
65
|
entities: (Placeholder | Component)[],
|
|
66
66
|
editContext: EditContextType,
|
|
67
|
-
): ComponentCommand[] {
|
|
67
|
+
): Promise<ComponentCommand[]> {
|
|
68
68
|
const components = entities.filter(
|
|
69
69
|
(x) => x && !isPlaceholder(x),
|
|
70
70
|
) as Component[];
|
|
71
71
|
|
|
72
72
|
const commands = [
|
|
73
|
-
getCreateCommentCommand(components),
|
|
74
|
-
getInsertCommand(components, editContext),
|
|
75
|
-
getDeleteCommand(components, editContext),
|
|
76
|
-
getDuplicateCommand(components, editContext),
|
|
77
|
-
getSyncCommand(entities, editContext),
|
|
78
|
-
getAiCommand(editContext),
|
|
79
|
-
getDesignCommand(components, editContext),
|
|
80
|
-
getLinkToMasterCommand(components, editContext),
|
|
81
|
-
getInheritChildrenFromMasterCommand(components, editContext),
|
|
73
|
+
await getCreateCommentCommand(components),
|
|
74
|
+
await getInsertCommand(components, editContext),
|
|
75
|
+
await getDeleteCommand(components, editContext),
|
|
76
|
+
await getDuplicateCommand(components, editContext),
|
|
77
|
+
await getSyncCommand(entities, editContext),
|
|
78
|
+
await getAiCommand(editContext),
|
|
79
|
+
await getDesignCommand(components, editContext),
|
|
80
|
+
await getLinkToMasterCommand(components, editContext),
|
|
81
|
+
await getInheritChildrenFromMasterCommand(components, editContext),
|
|
82
82
|
];
|
|
83
83
|
|
|
84
84
|
return commands.filter((x) => x !== null);
|
|
@@ -146,19 +146,18 @@ function getAiCommand(editContext: EditContextType): ComponentCommand {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
function getDesignCommand(
|
|
149
|
+
async function getDesignCommand(
|
|
150
150
|
components: Component[],
|
|
151
151
|
editContext: EditContextType,
|
|
152
|
-
): ComponentCommand | null {
|
|
152
|
+
): Promise<ComponentCommand | null> {
|
|
153
153
|
if (components.length !== 1 || isPlaceholder(components[0])) return null;
|
|
154
|
-
const
|
|
154
|
+
const component = components[0];
|
|
155
|
+
if (!component || !component.datasourceItem) return null;
|
|
156
|
+
const item = await editContext.itemsRepository.getItem(
|
|
157
|
+
component.datasourceItem,
|
|
158
|
+
);
|
|
155
159
|
if (!item) return null;
|
|
156
|
-
if (!item.
|
|
157
|
-
if (
|
|
158
|
-
!Object.values(item.datasourceItem.fields).find(
|
|
159
|
-
(x) => x.section === "Design",
|
|
160
|
-
)
|
|
161
|
-
)
|
|
160
|
+
if (!Object.values(item.fields).find((x) => x.section === "Design"))
|
|
162
161
|
return null;
|
|
163
162
|
|
|
164
163
|
return {
|
|
@@ -168,7 +167,7 @@ function getDesignCommand(
|
|
|
168
167
|
disabled: () => false,
|
|
169
168
|
execute: async (context: CommandContext<any>) => {
|
|
170
169
|
editContext.showFieldEditorPopup(
|
|
171
|
-
item.
|
|
170
|
+
item.fields || [],
|
|
172
171
|
["Design", "Rendering"],
|
|
173
172
|
context.event!,
|
|
174
173
|
);
|
|
@@ -177,10 +176,10 @@ function getDesignCommand(
|
|
|
177
176
|
};
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
function getLinkToMasterCommand(
|
|
179
|
+
async function getLinkToMasterCommand(
|
|
181
180
|
components: Component[],
|
|
182
181
|
editContext: EditContextType,
|
|
183
|
-
): ComponentCommand | null {
|
|
182
|
+
): Promise<ComponentCommand | null> {
|
|
184
183
|
if (!components.length) return null;
|
|
185
184
|
if (editContext.page?.item?.masterLanguages?.length === 0) return null;
|
|
186
185
|
|
|
@@ -192,21 +191,22 @@ function getLinkToMasterCommand(
|
|
|
192
191
|
);
|
|
193
192
|
}
|
|
194
193
|
|
|
195
|
-
function getCheckboxCommand(
|
|
194
|
+
async function getCheckboxCommand(
|
|
196
195
|
components: Component[],
|
|
197
196
|
editContext: EditContextType,
|
|
198
197
|
fieldName: string,
|
|
199
198
|
label: string,
|
|
200
|
-
): ComponentCommand | null {
|
|
201
|
-
const
|
|
202
|
-
(x) =>
|
|
203
|
-
x.datasourceItem?.fields.find((x) => x.name === fieldName)?.rawValue ===
|
|
204
|
-
"1",
|
|
199
|
+
): Promise<ComponentCommand | null> {
|
|
200
|
+
const items = await editContext.itemsRepository.getItems(
|
|
201
|
+
components.filter((x) => x.datasourceItem).map((x) => x.datasourceItem!),
|
|
205
202
|
);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
203
|
+
|
|
204
|
+
const someLinked = items.find(
|
|
205
|
+
(y) => y.fields.find((z) => z.name === fieldName)?.rawValue === "1",
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
const allLinked = !items.find(
|
|
209
|
+
(y) => y.fields.find((z) => z.name === fieldName)?.rawValue !== "1",
|
|
210
210
|
);
|
|
211
211
|
|
|
212
212
|
return {
|
|
@@ -221,10 +221,8 @@ function getCheckboxCommand(
|
|
|
221
221
|
label,
|
|
222
222
|
disabled: () => false,
|
|
223
223
|
execute: async () => {
|
|
224
|
-
|
|
225
|
-
const field = c.
|
|
226
|
-
(x) => x.name === fieldName,
|
|
227
|
-
);
|
|
224
|
+
items.forEach((c) => {
|
|
225
|
+
const field = c.fields.find((x) => x.name === fieldName);
|
|
228
226
|
if (!field) return;
|
|
229
227
|
editContext.operations.editField({
|
|
230
228
|
field: field.descriptor,
|
|
@@ -237,10 +235,10 @@ function getCheckboxCommand(
|
|
|
237
235
|
};
|
|
238
236
|
}
|
|
239
237
|
|
|
240
|
-
function getInheritChildrenFromMasterCommand(
|
|
238
|
+
async function getInheritChildrenFromMasterCommand(
|
|
241
239
|
components: Component[],
|
|
242
240
|
editContext: EditContextType,
|
|
243
|
-
): ComponentCommand | null {
|
|
241
|
+
): Promise<ComponentCommand | null> {
|
|
244
242
|
if (!components.length) return null;
|
|
245
243
|
if (editContext.page?.item?.masterLanguages?.length === 0) return null;
|
|
246
244
|
if (components.find((x) => !x.placeholders || x.placeholders.length === 0))
|
|
@@ -7,7 +7,9 @@ import { Component } from "../pageModel";
|
|
|
7
7
|
import { PageViewContext } from "../page-viewer/pageViewContext";
|
|
8
8
|
import { ArrowUpFromDot } from "lucide-react";
|
|
9
9
|
import { cn } from "../../lib/utils";
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
import { ComponentCommand } from "../commands/componentCommands";
|
|
12
|
+
|
|
11
13
|
export function FrameMenu({
|
|
12
14
|
component,
|
|
13
15
|
compareView,
|
|
@@ -21,6 +23,7 @@ export function FrameMenu({
|
|
|
21
23
|
const resizeObserverRef = useRef<ResizeObserver | null>(null);
|
|
22
24
|
const mutationObserverRef = useRef<MutationObserver | null>(null);
|
|
23
25
|
const headerRef = useRef<HTMLDivElement>(null);
|
|
26
|
+
const [commands, setCommands] = useState<ComponentCommand[]>([]);
|
|
24
27
|
|
|
25
28
|
const [componentRect, setComponentRect] = useState<Rect>();
|
|
26
29
|
const [isHeaderWiderThanComponent, setIsHeaderWiderThanComponent] =
|
|
@@ -135,7 +138,16 @@ export function FrameMenu({
|
|
|
135
138
|
|
|
136
139
|
if (!component || !editContext) return null;
|
|
137
140
|
|
|
138
|
-
const commands = editContext.getComponentCommands([component]);
|
|
141
|
+
// const commands = editContext.getComponentCommands([component]);
|
|
142
|
+
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
async function loadCommands() {
|
|
145
|
+
const commands = await editContext!.getComponentCommands([component]);
|
|
146
|
+
setCommands(commands);
|
|
147
|
+
}
|
|
148
|
+
loadCommands();
|
|
149
|
+
}, [component]);
|
|
150
|
+
|
|
139
151
|
const isDraggable =
|
|
140
152
|
component.canBeMoved &&
|
|
141
153
|
editContext.mode === "edit" &&
|
|
@@ -32,40 +32,47 @@ export function PictureEditorOverlay() {
|
|
|
32
32
|
|
|
33
33
|
setElement(pictureElement || undefined);
|
|
34
34
|
},
|
|
35
|
-
[iframe, editContext]
|
|
35
|
+
[iframe, editContext],
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
useEffect(() => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
39
|
+
const loadField = async () => {
|
|
40
|
+
if (element) {
|
|
41
|
+
const itemId = element.getAttribute("data-itemid");
|
|
42
|
+
const language = element.getAttribute("data-language");
|
|
43
|
+
const version = element.getAttribute("data-version");
|
|
44
|
+
const fieldId = element.getAttribute("data-fieldid");
|
|
45
|
+
|
|
46
|
+
if (
|
|
47
|
+
!itemId ||
|
|
48
|
+
!language ||
|
|
49
|
+
!version ||
|
|
50
|
+
!fieldId ||
|
|
51
|
+
!pageViewContext?.page ||
|
|
52
|
+
!iframe?.contentWindow
|
|
53
|
+
)
|
|
54
|
+
return;
|
|
55
|
+
|
|
56
|
+
const component = getComponentById(itemId, pageViewContext.page!);
|
|
57
|
+
|
|
58
|
+
if (component == null) return;
|
|
59
|
+
|
|
60
|
+
const item = await editContext!.itemsRepository.getItem(
|
|
61
|
+
component.datasourceItem!,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const pictureField = item?.fields.find(
|
|
65
|
+
(f) => f.id === fieldId,
|
|
66
|
+
) as PictureField;
|
|
67
|
+
|
|
68
|
+
if (!pictureField) return;
|
|
69
|
+
|
|
70
|
+
setField(pictureField);
|
|
71
|
+
} else {
|
|
72
|
+
setField(undefined);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
loadField();
|
|
69
76
|
}, [element, pageViewContext?.page]);
|
|
70
77
|
|
|
71
78
|
useEffect(() => {
|
|
@@ -73,7 +80,7 @@ export function PictureEditorOverlay() {
|
|
|
73
80
|
|
|
74
81
|
const sourceELement = getCurrentPictureSource(
|
|
75
82
|
element,
|
|
76
|
-
iframe.contentWindow
|
|
83
|
+
iframe.contentWindow,
|
|
77
84
|
);
|
|
78
85
|
|
|
79
86
|
if (sourceELement) {
|
|
@@ -100,7 +107,7 @@ export function PictureEditorOverlay() {
|
|
|
100
107
|
if (iframe?.contentDocument) {
|
|
101
108
|
iframe?.contentDocument.removeEventListener(
|
|
102
109
|
"mouseenter",
|
|
103
|
-
onMouseEnter
|
|
110
|
+
onMouseEnter,
|
|
104
111
|
);
|
|
105
112
|
}
|
|
106
113
|
|
|
@@ -135,7 +142,7 @@ export function PictureEditorOverlay() {
|
|
|
135
142
|
|
|
136
143
|
function getCurrentPictureSource(
|
|
137
144
|
pictureElement: HTMLElement,
|
|
138
|
-
iframeWindow: Window
|
|
145
|
+
iframeWindow: Window,
|
|
139
146
|
): HTMLElement | null {
|
|
140
147
|
if (pictureElement.tagName === "IMG") return pictureElement;
|
|
141
148
|
|
|
@@ -7,7 +7,7 @@ import { Insert } from "../sidebar/Insert";
|
|
|
7
7
|
import { useEffect, useState } from "react";
|
|
8
8
|
|
|
9
9
|
import { SimpleIconButton } from "../ui/SimpleIconButton";
|
|
10
|
-
import { Component, Field, RenderedItem } from "../pageModel";
|
|
10
|
+
import { Component, Field, FullItem, RenderedItem } from "../pageModel";
|
|
11
11
|
import { Spinner } from "../ui/Spinner";
|
|
12
12
|
import { PageViewContext } from "./pageViewContext";
|
|
13
13
|
import { SimpleTabs, Tab } from "../ui/SimpleTabs";
|
|
@@ -30,6 +30,7 @@ export function EditorForm({
|
|
|
30
30
|
const [activeTabKey, setActiveTabKey] = useState("content");
|
|
31
31
|
const [item, setItem] = useState<RenderedItem>();
|
|
32
32
|
const [component, setComponent] = useState<Component>();
|
|
33
|
+
const [fullItem, setFullItem] = useState<FullItem>();
|
|
33
34
|
|
|
34
35
|
const toggleInsertMode = () => {
|
|
35
36
|
if (insertMode) {
|
|
@@ -39,6 +40,15 @@ export function EditorForm({
|
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
42
|
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
async function loadFullItem() {
|
|
45
|
+
if (!item) return;
|
|
46
|
+
const fullItem = await editContext!.itemsRepository.getItem(item);
|
|
47
|
+
setFullItem(fullItem);
|
|
48
|
+
}
|
|
49
|
+
loadFullItem();
|
|
50
|
+
}, [item]);
|
|
51
|
+
|
|
42
52
|
useEffect(() => {
|
|
43
53
|
if (editContext.selectedForInsertion) setInsertMode(true);
|
|
44
54
|
}, [editContext.selectedForInsertion]);
|
|
@@ -83,7 +93,7 @@ export function EditorForm({
|
|
|
83
93
|
pageViewContext.pageItemDescriptor,
|
|
84
94
|
]);
|
|
85
95
|
|
|
86
|
-
if (!item)
|
|
96
|
+
if (!fullItem || !item)
|
|
87
97
|
return (
|
|
88
98
|
<div className="grid h-full w-full items-center justify-center">
|
|
89
99
|
<Spinner />
|
|
@@ -98,7 +108,7 @@ export function EditorForm({
|
|
|
98
108
|
x.item.version === item?.version,
|
|
99
109
|
)?.results || [];
|
|
100
110
|
|
|
101
|
-
let designFields = Object.values(
|
|
111
|
+
let designFields = Object.values(fullItem?.fields || []).filter(
|
|
102
112
|
(x) => x.section === "Design" || x.section === "Rendering",
|
|
103
113
|
);
|
|
104
114
|
|
|
@@ -106,7 +116,7 @@ export function EditorForm({
|
|
|
106
116
|
|
|
107
117
|
if (editorFields && editorFields["Design"]) {
|
|
108
118
|
editorFields["Design"]?.addFields.forEach((fieldName) => {
|
|
109
|
-
const field =
|
|
119
|
+
const field = fullItem?.fields.find((x) => x.name === fieldName);
|
|
110
120
|
if (field) designFields.push(field);
|
|
111
121
|
});
|
|
112
122
|
editorFields["Design"]?.removeFields.forEach((fieldName) => {
|
|
@@ -116,7 +126,7 @@ export function EditorForm({
|
|
|
116
126
|
|
|
117
127
|
const itemFields: ItemFields[] = [];
|
|
118
128
|
|
|
119
|
-
const contentFields = Object.values(
|
|
129
|
+
const contentFields = Object.values(fullItem?.fields || []).filter(
|
|
120
130
|
(x) =>
|
|
121
131
|
((editorFields && editorFields["Content"]?.addFields.includes(x.name!)) ||
|
|
122
132
|
item.renderedFieldIds.indexOf(x.id) >= 0) &&
|
|
@@ -131,7 +141,9 @@ export function EditorForm({
|
|
|
131
141
|
.forEach((i) => {
|
|
132
142
|
const fields: Field[] = [];
|
|
133
143
|
i.renderedFieldIds.forEach((id) => {
|
|
134
|
-
const field = Object.values(
|
|
144
|
+
const field = Object.values(fullItem?.fields || []).find(
|
|
145
|
+
(x) => x.id === id,
|
|
146
|
+
);
|
|
135
147
|
if (field) fields.push(field);
|
|
136
148
|
});
|
|
137
149
|
if (fields.length > 0) itemFields.push({ headline: i.name, fields });
|
|
@@ -164,7 +176,7 @@ export function EditorForm({
|
|
|
164
176
|
if (editorFields) {
|
|
165
177
|
Object.keys(editorFields).forEach((key) => {
|
|
166
178
|
if (key !== "Content" && key !== "Design") {
|
|
167
|
-
const fields =
|
|
179
|
+
const fields = fullItem?.fields.filter((x) =>
|
|
168
180
|
editorFields[key]?.addFields.includes(x.name!),
|
|
169
181
|
);
|
|
170
182
|
if (fields?.length)
|
|
@@ -183,9 +195,9 @@ export function EditorForm({
|
|
|
183
195
|
content: (
|
|
184
196
|
<div className="relative h-full">
|
|
185
197
|
<div className="absolute inset-0 overflow-auto">
|
|
186
|
-
<ItemInfo item={
|
|
198
|
+
<ItemInfo item={fullItem} />
|
|
187
199
|
<FieldList
|
|
188
|
-
fields={[{ fields:
|
|
200
|
+
fields={[{ fields: fullItem?.fields || [] }]}
|
|
189
201
|
validators={validators}
|
|
190
202
|
showStandardFieldsEnabled={true}
|
|
191
203
|
readonly={readonly}
|
|
@@ -231,7 +243,7 @@ export function EditorForm({
|
|
|
231
243
|
size="large"
|
|
232
244
|
disabled={
|
|
233
245
|
!editContext.page?.item.canWriteItem ||
|
|
234
|
-
!
|
|
246
|
+
!fullItem?.canWriteItem ||
|
|
235
247
|
editContext.mode !== "edit" ||
|
|
236
248
|
compareView
|
|
237
249
|
}
|
|
@@ -511,15 +511,13 @@ export function PageViewerFrame({
|
|
|
511
511
|
|
|
512
512
|
const fieldButtons = field ? await loadFieldButtons(field) : [];
|
|
513
513
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
) {
|
|
522
|
-
}
|
|
514
|
+
const showMenu = await showComponentContextMenu(
|
|
515
|
+
selectedComponents,
|
|
516
|
+
editContextRef.current!,
|
|
517
|
+
field,
|
|
518
|
+
fieldButtons,
|
|
519
|
+
);
|
|
520
|
+
if (showMenu) showMenu(adjustedEvent);
|
|
523
521
|
};
|
|
524
522
|
|
|
525
523
|
const handleLoad = () => {
|
package/src/editor/pageModel.ts
CHANGED
|
@@ -110,6 +110,14 @@ export type Timings = {
|
|
|
110
110
|
[key: string]: number;
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
+
export type ItemStub = ItemDescriptor & {
|
|
114
|
+
name: string;
|
|
115
|
+
templateId: string;
|
|
116
|
+
templateName: string;
|
|
117
|
+
icon: string;
|
|
118
|
+
path: string;
|
|
119
|
+
};
|
|
120
|
+
|
|
113
121
|
export type FullItem = ItemDescriptor & {
|
|
114
122
|
descriptor: ItemDescriptor;
|
|
115
123
|
name: string;
|
|
@@ -144,7 +152,7 @@ export type Page = {
|
|
|
144
152
|
rootComponent: Component;
|
|
145
153
|
};
|
|
146
154
|
|
|
147
|
-
export type RenderedItem = RenderedItemSkeleton &
|
|
155
|
+
export type RenderedItem = RenderedItemSkeleton & ItemStub;
|
|
148
156
|
|
|
149
157
|
type EditorFields = {
|
|
150
158
|
[group: string]: {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Site,
|
|
8
8
|
WorkboxItem,
|
|
9
9
|
} from "../../types";
|
|
10
|
-
import { FullItem, ItemDescriptor } from "../pageModel";
|
|
10
|
+
import { FullItem, ItemDescriptor, ItemStub } from "../pageModel";
|
|
11
11
|
|
|
12
12
|
export type ItemTreeNodeData = {
|
|
13
13
|
id: string;
|
|
@@ -34,7 +34,7 @@ export async function getChildren(
|
|
|
34
34
|
templateIds: string[] = [],
|
|
35
35
|
includeEmbeddedItems: boolean,
|
|
36
36
|
language: string,
|
|
37
|
-
include?: string
|
|
37
|
+
include?: string,
|
|
38
38
|
): Promise<ItemTreeNodeData[]> {
|
|
39
39
|
let url =
|
|
40
40
|
// configuration.services.editorService.baseUrl +
|
|
@@ -91,7 +91,7 @@ export async function getChildren(
|
|
|
91
91
|
// }
|
|
92
92
|
|
|
93
93
|
export async function fetchItems(
|
|
94
|
-
itemDescriptors: ItemDescriptor[]
|
|
94
|
+
itemDescriptors: ItemDescriptor[],
|
|
95
95
|
): Promise<FullItem[] | undefined> {
|
|
96
96
|
let url = "/alpaca/editor/items";
|
|
97
97
|
|
|
@@ -99,6 +99,15 @@ export async function fetchItems(
|
|
|
99
99
|
return response.data || [];
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
export async function fetchItemStubs(
|
|
103
|
+
itemDescriptors: ItemDescriptor[],
|
|
104
|
+
): Promise<ItemStub[] | undefined> {
|
|
105
|
+
let url = "/alpaca/editor/itemstubs";
|
|
106
|
+
|
|
107
|
+
const response = await post<ItemStub[]>(url, itemDescriptors);
|
|
108
|
+
return response.data || [];
|
|
109
|
+
}
|
|
110
|
+
|
|
102
111
|
export async function getSites() {
|
|
103
112
|
return await get<Site[]>("/alpaca/editor/sites");
|
|
104
113
|
}
|
|
@@ -106,7 +115,7 @@ export async function getSites() {
|
|
|
106
115
|
export async function resolvePageAndSite(
|
|
107
116
|
itemId: string,
|
|
108
117
|
language: string,
|
|
109
|
-
version: number
|
|
118
|
+
version: number,
|
|
110
119
|
): Promise<
|
|
111
120
|
| { pageItem: ItemDescriptor; site: { name: string }; isHeadless: boolean }
|
|
112
121
|
| undefined
|
|
@@ -130,7 +139,7 @@ export async function resolvePageAndSite(
|
|
|
130
139
|
export async function getLanguagesAndVersions(item: ItemDescriptor) {
|
|
131
140
|
return await post<LanguagesAndVersions>(
|
|
132
141
|
"/alpaca/editor/getLanguagesAndVersions",
|
|
133
|
-
item
|
|
142
|
+
item,
|
|
134
143
|
);
|
|
135
144
|
}
|
|
136
145
|
|
|
@@ -149,7 +158,7 @@ export async function getDictionary(siteName: string, language: string) {
|
|
|
149
158
|
"/alpaca/editor/dictionary/index?siteName=" +
|
|
150
159
|
siteName +
|
|
151
160
|
"&language=" +
|
|
152
|
-
language
|
|
161
|
+
language,
|
|
153
162
|
);
|
|
154
163
|
return response.data as EditableDictionary;
|
|
155
164
|
}
|
|
@@ -277,7 +277,7 @@ export function ComponentTree({}) {
|
|
|
277
277
|
);
|
|
278
278
|
|
|
279
279
|
// Handle tree context menu
|
|
280
|
-
const handleTreeContextMenu = (
|
|
280
|
+
const handleTreeContextMenu = async (
|
|
281
281
|
node: TreeNode<Component>,
|
|
282
282
|
event: React.MouseEvent,
|
|
283
283
|
) => {
|
|
@@ -308,7 +308,7 @@ export function ComponentTree({}) {
|
|
|
308
308
|
selectedEntities = [nodeDictionary[node.key]!.data as Component];
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
let commands = getComponentCommands(
|
|
311
|
+
let commands = await getComponentCommands(
|
|
312
312
|
selectedEntities,
|
|
313
313
|
editContextRef.current!,
|
|
314
314
|
);
|
package/src/revision.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = "1.0.
|
|
2
|
-
export const buildDate = "2025-04-
|
|
1
|
+
export const version = "1.0.3849";
|
|
2
|
+
export const buildDate = "2025-04-27 12:30:47";
|