@alpaca-editor/core 1.0.4082 → 1.0.4084
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/card.js.map +1 -1
- package/dist/editor/FieldListField.d.ts +3 -2
- package/dist/editor/FieldListField.js +8 -8
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/FieldListFieldWithFallbacks.js +2 -2
- package/dist/editor/FieldListFieldWithFallbacks.js.map +1 -1
- package/dist/editor/client/EditorShell.js +11 -3
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +1 -0
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/hooks/useWorkbox.js +6 -7
- package/dist/editor/client/hooks/useWorkbox.js.map +1 -1
- package/dist/editor/client/ui/EditorChrome.js +2 -1
- package/dist/editor/client/ui/EditorChrome.js.map +1 -1
- package/dist/editor/component-designer/ComponentDesigner.d.ts +1 -1
- package/dist/editor/component-designer/ComponentDesigner.js +48 -53
- package/dist/editor/component-designer/ComponentDesigner.js.map +1 -1
- package/dist/editor/control-center/About.js +1 -1
- package/dist/editor/control-center/About.js.map +1 -1
- package/dist/editor/field-types/RichTextEditor.d.ts +2 -1
- package/dist/editor/field-types/RichTextEditor.js +4 -4
- package/dist/editor/field-types/RichTextEditor.js.map +1 -1
- package/dist/editor/field-types/RichTextEditorComponent.d.ts +2 -1
- package/dist/editor/field-types/RichTextEditorComponent.js +2 -2
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
- package/dist/editor/field-types/richtext/components/ReactSlate.js +30 -23
- package/dist/editor/field-types/richtext/components/ReactSlate.js.map +1 -1
- package/dist/editor/field-types/richtext/components/ToolbarButton.d.ts +2 -2
- package/dist/editor/field-types/richtext/components/ToolbarButton.js +3 -10
- package/dist/editor/field-types/richtext/components/ToolbarButton.js.map +1 -1
- package/dist/editor/field-types/richtext/types.d.ts +1 -0
- package/dist/editor/field-types/richtext/types.js.map +1 -1
- package/dist/editor/field-types/richtext/utils/conversion.js +33 -8
- package/dist/editor/field-types/richtext/utils/conversion.js.map +1 -1
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js +11 -2
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js.map +1 -1
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js +1 -1
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js.map +1 -1
- package/dist/editor/page-viewer/EditorForm.js +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +2 -1
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/page-wizard/steps/SelectStep.js +28 -12
- package/dist/page-wizard/steps/SelectStep.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/styles.css +24 -0
- package/package.json +1 -2
- package/src/components/ui/card.tsx +1 -1
- package/src/editor/FieldListField.tsx +11 -4
- package/src/editor/FieldListFieldWithFallbacks.tsx +3 -1
- package/src/editor/client/EditorShell.tsx +20 -4
- package/src/editor/client/editContext.ts +1 -0
- package/src/editor/client/hooks/useWorkbox.ts +6 -7
- package/src/editor/client/ui/EditorChrome.tsx +4 -1
- package/src/editor/component-designer/ComponentDesigner.tsx +49 -53
- package/src/editor/control-center/About.tsx +0 -15
- package/src/editor/field-types/RichTextEditor.tsx +13 -10
- package/src/editor/field-types/RichTextEditorComponent.tsx +3 -0
- package/src/editor/field-types/richtext/components/ReactSlate.tsx +498 -437
- package/src/editor/field-types/richtext/components/ToolbarButton.tsx +12 -14
- package/src/editor/field-types/richtext/types.ts +18 -10
- package/src/editor/field-types/richtext/utils/conversion.ts +37 -10
- package/src/editor/page-editor-chrome/FieldActionIndicator.tsx +63 -7
- package/src/editor/page-editor-chrome/FieldActionIndicators.tsx +1 -1
- package/src/editor/page-viewer/EditorForm.tsx +2 -2
- package/src/editor/page-viewer/PageViewerFrame.tsx +2 -1
- package/src/page-wizard/steps/SelectStep.tsx +47 -18
- package/src/revision.ts +2 -2
- package/dist/editor/ui/StackedPanels.d.ts +0 -5
- package/dist/editor/ui/StackedPanels.js +0 -67
- package/dist/editor/ui/StackedPanels.js.map +0 -1
- package/src/editor/ui/StackedPanels.tsx +0 -134
|
@@ -28,9 +28,8 @@ export function SelectStep({ step, data, setData, setStepCompleted, internalStat
|
|
|
28
28
|
if (error) {
|
|
29
29
|
console.warn(`Error evaluating input properties "${inputProperties}":`, error);
|
|
30
30
|
}
|
|
31
|
-
if (existingValues
|
|
31
|
+
if (Array.isArray(existingValues) && existingValues.length) {
|
|
32
32
|
setStepCompleted(true);
|
|
33
|
-
setSelectedOptions(existingValues);
|
|
34
33
|
}
|
|
35
34
|
}, [data, inputProperties]);
|
|
36
35
|
// Initialize the property in data
|
|
@@ -74,14 +73,27 @@ Create ${step.fields.numberOfOptions || 5} relevant options.`,
|
|
|
74
73
|
try {
|
|
75
74
|
const lastMessage = result.messages[result.messages.length - 1];
|
|
76
75
|
if (lastMessage && lastMessage.content) {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
const parsed = JSON.parse(lastMessage.content);
|
|
77
|
+
const optionsArray = Array.isArray(parsed)
|
|
78
|
+
? parsed
|
|
79
|
+
: Array.isArray(parsed?.options)
|
|
80
|
+
? parsed.options
|
|
81
|
+
: [];
|
|
82
|
+
if (!Array.isArray(optionsArray) || optionsArray.length === 0) {
|
|
83
|
+
throw new Error("Parsed response did not contain any options");
|
|
80
84
|
}
|
|
81
|
-
|
|
85
|
+
const normalizedOptions = optionsArray.map((opt, index) => ({
|
|
86
|
+
id: String(opt?.id ?? opt?.value ?? index),
|
|
87
|
+
title: String(opt?.title ??
|
|
88
|
+
opt?.label ??
|
|
89
|
+
opt?.name ??
|
|
90
|
+
`Option ${index + 1}`),
|
|
91
|
+
description: String(opt?.description ?? opt?.details ?? opt?.summary ?? ""),
|
|
92
|
+
}));
|
|
93
|
+
setOptions(normalizedOptions);
|
|
82
94
|
setInternalState((state) => ({
|
|
83
95
|
...state,
|
|
84
|
-
[step.id + "options"]:
|
|
96
|
+
[step.id + "options"]: normalizedOptions,
|
|
85
97
|
}));
|
|
86
98
|
}
|
|
87
99
|
}
|
|
@@ -113,8 +125,10 @@ Create ${step.fields.numberOfOptions || 5} relevant options.`,
|
|
|
113
125
|
// Sync data with selectedOptions state using flexible expression
|
|
114
126
|
useEffect(() => {
|
|
115
127
|
const { value: currentSelections } = evaluateDataExpression(inputProperties, data);
|
|
116
|
-
const selectionsArray = currentSelections
|
|
117
|
-
|
|
128
|
+
const selectionsArray = Array.isArray(currentSelections)
|
|
129
|
+
? currentSelections
|
|
130
|
+
: [];
|
|
131
|
+
setSelectedOptions(selectionsArray.map((option) => typeof option === "string" ? option : option.id));
|
|
118
132
|
}, [data, inputProperties]);
|
|
119
133
|
// Handle option selection
|
|
120
134
|
const handleOptionSelect = (option) => {
|
|
@@ -137,15 +151,17 @@ Create ${step.fields.numberOfOptions || 5} relevant options.`,
|
|
|
137
151
|
if (error) {
|
|
138
152
|
return (_jsxs("div", { className: "p-4 text-red-500", children: [error, _jsx("button", { className: "ml-4 rounded bg-blue-500 px-2 py-1 text-white", onClick: () => window.location.reload(), children: "Retry" })] }));
|
|
139
153
|
}
|
|
140
|
-
return (_jsxs("div", { className: "flex h-full flex-col md:flex-row", children: [_jsx(WizardBox, { title: step.fields.configureTitle || "Configuration", icon: _jsx(Settings, {}), description: step.fields.configureDescription ||
|
|
141
|
-
"Configure instructions and regenerate options", className: "md:w-96", children: _jsxs("div", { className: "flex h-full flex-col items-stretch", children: [_jsx("div", { className: "relative flex-1", children: _jsxs("div", { className: "absolute inset-0 overflow-y-auto", children: [_jsx("h3", { className: "text-sm font-bold", children: "Instructions" }), _jsx(InputTextarea, { className: "h-48 w-full text-sm", value: instructions, onChange: (e) => setInstructions(e.target.value), placeholder: "Enter instructions for generating the options" })] }) }), _jsx("div", { className: "py-2", children: _jsx(ActionButton, { onClick: generateOptions, isLoading: loading, disabled: loading, loadingText: "Thinking...", className: "w-full", children: "Regenerate Options" }) })] }) }), _jsx(WizardBoxConnector, {}), _jsx(WizardBox, { title: step.fields.selectOptionsTitle || "Select Options", icon: _jsx(CheckSquare, {}), description: step.fields.selectOptionsDescription ||
|
|
154
|
+
return (_jsxs("div", { className: "flex h-full flex-col md:flex-row", children: [_jsx(WizardBox, { title: step.fields.configureTitle || "Configuration", icon: _jsx(Settings, { strokeWidth: 1 }), description: step.fields.configureDescription ||
|
|
155
|
+
"Configure instructions and regenerate options", className: "md:w-96", children: _jsxs("div", { className: "flex h-full flex-col items-stretch", children: [_jsx("div", { className: "relative flex-1", children: _jsxs("div", { className: "absolute inset-0 overflow-y-auto", children: [_jsx("h3", { className: "text-sm font-bold", children: "Instructions" }), _jsx(InputTextarea, { className: "h-48 w-full text-sm", value: instructions, onChange: (e) => setInstructions(e.target.value), placeholder: "Enter instructions for generating the options" })] }) }), _jsx("div", { className: "py-2", children: _jsx(ActionButton, { onClick: generateOptions, isLoading: loading, disabled: loading, loadingText: "Thinking...", className: "w-full", children: "Regenerate Options" }) })] }) }), _jsx(WizardBoxConnector, {}), _jsx(WizardBox, { title: step.fields.selectOptionsTitle || "Select Options", icon: _jsx(CheckSquare, { strokeWidth: 1 }), description: step.fields.selectOptionsDescription ||
|
|
142
156
|
"Choose from the generated options below", className: "flex-1", children: _jsxs("div", { className: "h-full", children: [loading && (_jsx("div", { className: "flex h-full items-center justify-center", children: _jsx(Generate, { title: step.fields.generatingOptionsText || "Generating options..." }) })), !loading && (_jsx("div", { children: options.length === 0 ? (_jsx("div", { className: "p-4 text-gray-500", children: "No options available. Try refreshing the page." })) : (options.map((option, index) => {
|
|
143
157
|
const isSelected = selectedOptions.includes(option.id);
|
|
144
158
|
return (_jsxs("div", { className: classNames("mb-3 flex items-center rounded border-2 bg-white p-3", index % 2 === 0
|
|
145
159
|
? "animate-fadeRight"
|
|
146
160
|
: "animate-fadeLeft", isSelected
|
|
147
161
|
? "text-theme-secondary border-theme-secondary"
|
|
148
|
-
: "border-gray-300 text-gray-600"), onClick: () => handleOptionSelect(option), children: [_jsxs("div", { className: "flex flex-1 cursor-pointer flex-col", children: [_jsx("div", { className: "font-medium", children: option.title }), _jsx("div", { className: "text-xs text-gray-600", children: option.description })] }),
|
|
162
|
+
: "border-gray-300 text-gray-600"), onClick: () => handleOptionSelect(option), children: [_jsxs("div", { className: "flex flex-1 cursor-pointer flex-col", children: [_jsx("div", { className: "font-medium", children: option.title }), _jsx("div", { className: "text-xs text-gray-600", children: option.description })] }), _jsx("div", { className: classNames("ml-2 flex h-6 w-6 items-center justify-center rounded-full text-white", isSelected
|
|
163
|
+
? "bg-theme-secondary opacity-100"
|
|
164
|
+
: "opacity-0"), children: "\u2713" })] }, option.id));
|
|
149
165
|
})) }))] }) })] }));
|
|
150
166
|
}
|
|
151
167
|
//# sourceMappingURL=SelectStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectStep.js","sourceRoot":"","sources":["../../../src/page-wizard/steps/SelectStep.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;A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mBAAmB;wCACrB,CAAC,CAAC,kBAAkB,EACtB,UAAU;wCACR,CAAC,CAAC,6CAA6C;wCAC/C,CAAC,CAAC,+BAA+B,CACpC,EACD,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC,aAEzC,eAAK,SAAS,EAAC,qCAAqC,aAClD,cAAK,SAAS,EAAC,aAAa,YAAE,MAAM,CAAC,KAAK,GAAO,EACjD,cAAK,SAAS,EAAC,uBAAuB,YACnC,MAAM,CAAC,WAAW,GACf,IACF,EACN,cACE,SAAS,EAAE,UAAU,CACnB,uEAAuE,EACvE,UAAU;gDACR,CAAC,CAAC,gCAAgC;gDAClC,CAAC,CAAC,WAAW,CAChB,uBAGG,KA3BD,MAAM,CAAC,EAAE,CA4BV,CACP,CAAC;4BACJ,CAAC,CAAC,CACH,GACG,CACP,IACG,GACI,IACR,CACP,CAAC;AACJ,CAAC"}
|
package/dist/revision.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.0.
|
|
2
|
-
export declare const buildDate = "2025-09-
|
|
1
|
+
export declare const version = "1.0.4084";
|
|
2
|
+
export declare const buildDate = "2025-09-11 12:15:31";
|
package/dist/revision.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const version = "1.0.
|
|
2
|
-
export const buildDate = "2025-09-
|
|
1
|
+
export const version = "1.0.4084";
|
|
2
|
+
export const buildDate = "2025-09-11 12:15:31";
|
|
3
3
|
//# sourceMappingURL=revision.js.map
|
package/dist/styles.css
CHANGED
|
@@ -215,6 +215,9 @@
|
|
|
215
215
|
.top-0 {
|
|
216
216
|
top: calc(var(--spacing) * 0);
|
|
217
217
|
}
|
|
218
|
+
.top-1 {
|
|
219
|
+
top: calc(var(--spacing) * 1);
|
|
220
|
+
}
|
|
218
221
|
.top-1\/2 {
|
|
219
222
|
top: calc(1/2 * 100%);
|
|
220
223
|
}
|
|
@@ -2463,6 +2466,10 @@
|
|
|
2463
2466
|
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
2464
2467
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
2465
2468
|
}
|
|
2469
|
+
.ring-1 {
|
|
2470
|
+
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
2471
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
2472
|
+
}
|
|
2466
2473
|
.ring-2 {
|
|
2467
2474
|
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
2468
2475
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
@@ -2473,6 +2480,9 @@
|
|
|
2473
2480
|
.ring-purple-200 {
|
|
2474
2481
|
--tw-ring-color: var(--color-purple-200);
|
|
2475
2482
|
}
|
|
2483
|
+
.ring-red-200 {
|
|
2484
|
+
--tw-ring-color: var(--color-red-200);
|
|
2485
|
+
}
|
|
2476
2486
|
.ring-offset-background {
|
|
2477
2487
|
--tw-ring-offset-color: var(--background);
|
|
2478
2488
|
}
|
|
@@ -2969,6 +2979,13 @@
|
|
|
2969
2979
|
}
|
|
2970
2980
|
}
|
|
2971
2981
|
}
|
|
2982
|
+
.hover\:bg-red-100 {
|
|
2983
|
+
&:hover {
|
|
2984
|
+
@media (hover: hover) {
|
|
2985
|
+
background-color: var(--color-red-100);
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2972
2989
|
.hover\:bg-red-400 {
|
|
2973
2990
|
&:hover {
|
|
2974
2991
|
@media (hover: hover) {
|
|
@@ -3017,6 +3034,13 @@
|
|
|
3017
3034
|
}
|
|
3018
3035
|
}
|
|
3019
3036
|
}
|
|
3037
|
+
.hover\:bg-white {
|
|
3038
|
+
&:hover {
|
|
3039
|
+
@media (hover: hover) {
|
|
3040
|
+
background-color: var(--color-white);
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3020
3044
|
.hover\:bg-gradient-to-r {
|
|
3021
3045
|
&:hover {
|
|
3022
3046
|
@media (hover: hover) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpaca-editor/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4084",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"@types/lodash": "^4.17.16",
|
|
43
43
|
"@uiw/react-md-editor": "^4.0.5",
|
|
44
44
|
"@uiw/react-textarea-code-editor": "^3.1.1",
|
|
45
|
-
"allotment": "^1.20.3",
|
|
46
45
|
"axios": "^1.6.7",
|
|
47
46
|
"class-variance-authority": "^0.7.1",
|
|
48
47
|
"clsx": "^2.1.1",
|
|
@@ -367,7 +367,7 @@ export function Card({
|
|
|
367
367
|
|
|
368
368
|
{/* Footer - always displayed regardless of collapsed state */}
|
|
369
369
|
{footer && (
|
|
370
|
-
<div className="border-t border-gray-100 p-4 pt-0 md:p-6
|
|
370
|
+
<div className="border-t border-gray-100 p-4 pt-0 md:p-6">
|
|
371
371
|
{footer}
|
|
372
372
|
</div>
|
|
373
373
|
)}
|
|
@@ -47,6 +47,7 @@ export default function FieldListField({
|
|
|
47
47
|
showFallbackButton,
|
|
48
48
|
compareToField,
|
|
49
49
|
readonly,
|
|
50
|
+
isHoveringField,
|
|
50
51
|
}: {
|
|
51
52
|
field: Field;
|
|
52
53
|
validators: SingleValidatorResult[];
|
|
@@ -56,6 +57,7 @@ export default function FieldListField({
|
|
|
56
57
|
showFallbackButton?: React.ReactNode;
|
|
57
58
|
compareToField?: Field;
|
|
58
59
|
readonly?: boolean;
|
|
60
|
+
isHoveringField?: boolean;
|
|
59
61
|
}) {
|
|
60
62
|
const editContext = useEditContext();
|
|
61
63
|
if (!editContext) return;
|
|
@@ -156,11 +158,11 @@ export default function FieldListField({
|
|
|
156
158
|
setButtons(buttons);
|
|
157
159
|
};
|
|
158
160
|
|
|
159
|
-
if (isFocusedField) {
|
|
161
|
+
if (isFocusedField || isHoveringField) {
|
|
160
162
|
if (field.buttons) setButtons(field.buttons);
|
|
161
163
|
else load();
|
|
162
164
|
}
|
|
163
|
-
}, [isFocusedField]);
|
|
165
|
+
}, [isFocusedField, isHoveringField]);
|
|
164
166
|
|
|
165
167
|
const renderGeneratorButtons = useMemo(() => {
|
|
166
168
|
if (generatorButtons?.length || 0 > 0)
|
|
@@ -287,7 +289,7 @@ export default function FieldListField({
|
|
|
287
289
|
locked by {fieldLockedBySession.user.name}
|
|
288
290
|
</div>
|
|
289
291
|
)}
|
|
290
|
-
{isFocusedField &&
|
|
292
|
+
{(isFocusedField || isHoveringField) &&
|
|
291
293
|
(!fieldLockedBySession ||
|
|
292
294
|
fieldLockedBySession?.sessionId === editContext.sessionId) && (
|
|
293
295
|
<>
|
|
@@ -372,7 +374,7 @@ export default function FieldListField({
|
|
|
372
374
|
<PopoverTrigger asChild>
|
|
373
375
|
<TooltipTrigger asChild>
|
|
374
376
|
<button
|
|
375
|
-
className="rounded p-1 transition-colors hover:bg-gray-100
|
|
377
|
+
className="cursor-pointer rounded p-1 transition-colors hover:bg-gray-100"
|
|
376
378
|
aria-label="Field History"
|
|
377
379
|
>
|
|
378
380
|
<History strokeWidth={1} className="h-3.5 w-3.5" />
|
|
@@ -426,6 +428,7 @@ export default function FieldListField({
|
|
|
426
428
|
historyEntry ? true : isReadOnly,
|
|
427
429
|
editContext.configuration,
|
|
428
430
|
debouncedSetFieldvalue,
|
|
431
|
+
isFocusedField,
|
|
429
432
|
)}
|
|
430
433
|
</div>
|
|
431
434
|
)}
|
|
@@ -438,6 +441,7 @@ export default function FieldListField({
|
|
|
438
441
|
isReadOnly,
|
|
439
442
|
editContext.configuration,
|
|
440
443
|
debouncedSetFieldvalue,
|
|
444
|
+
isFocusedField,
|
|
441
445
|
)}
|
|
442
446
|
</div>
|
|
443
447
|
<div className="flex-1">
|
|
@@ -447,6 +451,7 @@ export default function FieldListField({
|
|
|
447
451
|
true,
|
|
448
452
|
editContext.configuration,
|
|
449
453
|
debouncedSetFieldvalue,
|
|
454
|
+
isFocusedField,
|
|
450
455
|
)}
|
|
451
456
|
</div>
|
|
452
457
|
</div>
|
|
@@ -462,6 +467,7 @@ export function getFieldEditor(
|
|
|
462
467
|
isReadOnly: boolean,
|
|
463
468
|
configuration: EditorConfiguration,
|
|
464
469
|
debouncedSetFieldvalue: (value: string) => void,
|
|
470
|
+
isFocusedField: boolean,
|
|
465
471
|
) {
|
|
466
472
|
let fieldType = showRawValue ? "raw" : field.type;
|
|
467
473
|
|
|
@@ -475,6 +481,7 @@ export function getFieldEditor(
|
|
|
475
481
|
<typeConfig.editor
|
|
476
482
|
field={field}
|
|
477
483
|
readOnly={isReadOnly}
|
|
484
|
+
isFocusedField={isFocusedField}
|
|
478
485
|
updateFieldValue={(value: string) => {
|
|
479
486
|
debouncedSetFieldvalue(value);
|
|
480
487
|
}}
|
|
@@ -191,10 +191,11 @@ export function FieldListFieldWithFallbacks({
|
|
|
191
191
|
validators={validators}
|
|
192
192
|
simplified={simplified}
|
|
193
193
|
title={title}
|
|
194
|
-
isFocusedField={isFocusedField
|
|
194
|
+
isFocusedField={isFocusedField}
|
|
195
195
|
showFallbackButton={showFallbackButton}
|
|
196
196
|
compareToField={compareToField}
|
|
197
197
|
readonly={readonly}
|
|
198
|
+
isHoveringField={hover}
|
|
198
199
|
/>
|
|
199
200
|
{field.isFallback && isFocusedField && showFallback && (
|
|
200
201
|
<>
|
|
@@ -211,6 +212,7 @@ export function FieldListFieldWithFallbacks({
|
|
|
211
212
|
simplified={true}
|
|
212
213
|
isFocusedField={true}
|
|
213
214
|
readonly={readonly}
|
|
215
|
+
isHoveringField={hover}
|
|
214
216
|
title=<div className="text-xs">
|
|
215
217
|
{x.displayName || x.name} ({x.descriptor.item.language})
|
|
216
218
|
{x.descriptor.item.id != field.descriptor.item.id && (
|
|
@@ -992,10 +992,10 @@ export function EditorShell({
|
|
|
992
992
|
}
|
|
993
993
|
|
|
994
994
|
const newUrl = `${pathname}?${current.toString()}`;
|
|
995
|
-
const oldUrl = `${pathname}
|
|
995
|
+
const oldUrl = `${pathname}${window.location.search}`;
|
|
996
996
|
|
|
997
997
|
if (newUrl !== oldUrl) {
|
|
998
|
-
|
|
998
|
+
window.history.pushState(null, "", newUrl);
|
|
999
999
|
}
|
|
1000
1000
|
}, [
|
|
1001
1001
|
currentItemDescriptor,
|
|
@@ -1450,6 +1450,7 @@ export function EditorShell({
|
|
|
1450
1450
|
(params: Record<string, string | undefined>) => {
|
|
1451
1451
|
const url = new URL(window.location.href);
|
|
1452
1452
|
const oldUrl = url.toString();
|
|
1453
|
+
|
|
1453
1454
|
Object.entries(params).forEach(([key, value]) => {
|
|
1454
1455
|
if (value) url.searchParams.set(key, value);
|
|
1455
1456
|
else url.searchParams.delete(key);
|
|
@@ -1526,14 +1527,16 @@ export function EditorShell({
|
|
|
1526
1527
|
configuration,
|
|
1527
1528
|
updateUrl,
|
|
1528
1529
|
openSplashScreen: () => {
|
|
1529
|
-
const currentParams = new URLSearchParams(window.location.search);
|
|
1530
|
+
const currentParams = new URLSearchParams(window.location.search);
|
|
1530
1531
|
const preservedParams = new URLSearchParams();
|
|
1531
1532
|
|
|
1532
1533
|
if (currentParams.get("fullscreen") === "true") {
|
|
1533
1534
|
preservedParams.set("fullscreen", "true");
|
|
1534
1535
|
}
|
|
1535
1536
|
const queryString = preservedParams.toString();
|
|
1536
|
-
const newUrl = queryString
|
|
1537
|
+
const newUrl = queryString
|
|
1538
|
+
? `/alpaca/editor?${queryString}`
|
|
1539
|
+
: "/alpaca/editor";
|
|
1537
1540
|
router.push(newUrl);
|
|
1538
1541
|
},
|
|
1539
1542
|
item: contentEditorItem || page?.item,
|
|
@@ -1742,6 +1745,19 @@ export function EditorShell({
|
|
|
1742
1745
|
requestRefresh("immediate");
|
|
1743
1746
|
}
|
|
1744
1747
|
},
|
|
1748
|
+
dismissFieldAction: (fieldDescriptor: FieldDescriptor) => {
|
|
1749
|
+
setActiveFieldActions((prevFieldActions) =>
|
|
1750
|
+
prevFieldActions.filter(
|
|
1751
|
+
(x) =>
|
|
1752
|
+
!(
|
|
1753
|
+
x.field.fieldId === fieldDescriptor.fieldId &&
|
|
1754
|
+
x.field.item.id === fieldDescriptor.item.id &&
|
|
1755
|
+
x.field.item.language === fieldDescriptor.item.language &&
|
|
1756
|
+
x.field.item.version === fieldDescriptor.item.version
|
|
1757
|
+
),
|
|
1758
|
+
),
|
|
1759
|
+
);
|
|
1760
|
+
},
|
|
1745
1761
|
activeFieldActions,
|
|
1746
1762
|
showContextMenu: (event: any, items: MenuItem[]) => {
|
|
1747
1763
|
contextMenuRef.current?.show(event, items);
|
|
@@ -242,6 +242,7 @@ export type EditContextType = {
|
|
|
242
242
|
action: FieldButton,
|
|
243
243
|
parameters?: Record<string, string>,
|
|
244
244
|
) => void;
|
|
245
|
+
dismissFieldAction: (field: FieldDescriptor) => void;
|
|
245
246
|
activeFieldActions: FieldAction[];
|
|
246
247
|
showContextMenu(e: any, menuItems: MenuItem[]): void;
|
|
247
248
|
setCurrentOverlay: React.Dispatch<React.SetStateAction<any>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { useDebouncedCallback } from "use-debounce";
|
|
2
3
|
import { getWorkbox } from "../../services/contentService";
|
|
3
4
|
import { getItemDescriptor } from "../../utils";
|
|
4
5
|
import { ItemDescriptor, Component } from "../../pageModel";
|
|
@@ -35,21 +36,19 @@ export function useWorkbox(params: {
|
|
|
35
36
|
setWorkboxItems(sorted);
|
|
36
37
|
}, []);
|
|
37
38
|
|
|
38
|
-
const loadWorkboxDebounced =
|
|
39
|
+
const loadWorkboxDebounced = useDebouncedCallback(
|
|
39
40
|
(items: ItemDescriptor[]) => {
|
|
40
|
-
|
|
41
|
-
const handle = setTimeout(() => loadWorkbox(items), 5000);
|
|
42
|
-
return () => clearTimeout(handle);
|
|
41
|
+
loadWorkbox(items);
|
|
43
42
|
},
|
|
44
|
-
|
|
43
|
+
500,
|
|
45
44
|
);
|
|
46
45
|
|
|
47
46
|
useEffect(() => {
|
|
48
47
|
const items: ItemDescriptor[] = [];
|
|
49
48
|
if (contentEditorItem) items.push(contentEditorItem.descriptor);
|
|
50
49
|
if (page) collectAllItems(page.rootComponent, items);
|
|
51
|
-
|
|
52
|
-
return
|
|
50
|
+
loadWorkboxDebounced(items.filter(Boolean));
|
|
51
|
+
return () => loadWorkboxDebounced.cancel();
|
|
53
52
|
}, [page, contentEditorItem, loadWorkboxDebounced]);
|
|
54
53
|
|
|
55
54
|
function collectAllItems(component: Component, items: ItemDescriptor[]) {
|
|
@@ -48,7 +48,10 @@ export function EditorChrome(props: {
|
|
|
48
48
|
rightSidebarTitle={currentView.rightSidebar?.title}
|
|
49
49
|
farRightSidebar={
|
|
50
50
|
showAgentsPanel &&
|
|
51
|
-
!
|
|
51
|
+
!editContext.currentWizardId &&
|
|
52
|
+
!["splash-screen", "open-page", "new-page", "page-wizard"].includes(
|
|
53
|
+
viewName,
|
|
54
|
+
) && (
|
|
52
55
|
<SidebarView
|
|
53
56
|
sidebar={{
|
|
54
57
|
title: "Agents",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentRenderingEditor } from "./ComponentRenderingEditor";
|
|
2
2
|
import { Splitter, SplitterPanel } from "primereact/splitter";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { Panel } from "../../config/types";
|
|
5
5
|
|
|
6
6
|
import { PlaceholdersEditor } from "./PlaceholdersEditor";
|
|
@@ -15,56 +15,52 @@ import {
|
|
|
15
15
|
import { PageViewerFrame } from "../page-viewer/PageViewerFrame";
|
|
16
16
|
|
|
17
17
|
export function ComponentDesigner() {
|
|
18
|
-
const [allComponents, setAllComponents] = useState<Component[]>([]);
|
|
19
|
-
const context = useEditContext();
|
|
20
|
-
if (!context?.page) return null;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
<PageViewerFrame compareView={false} />
|
|
67
|
-
</SplitterPanel>
|
|
68
|
-
</Splitter>
|
|
69
|
-
);
|
|
18
|
+
// const [allComponents, setAllComponents] = useState<Component[]>([]);
|
|
19
|
+
// const context = useEditContext();
|
|
20
|
+
// if (!context?.page) return null;
|
|
21
|
+
// useEffect(() => {
|
|
22
|
+
// async function loadComponents() {
|
|
23
|
+
// if (context?.page) {
|
|
24
|
+
// const components = await getAllComponents(context.page.item.id);
|
|
25
|
+
// setAllComponents(components);
|
|
26
|
+
// } else setAllComponents([]);
|
|
27
|
+
// }
|
|
28
|
+
// loadComponents();
|
|
29
|
+
// }, [context.page]);
|
|
30
|
+
// const mainPanels: Panel[] = [
|
|
31
|
+
// {
|
|
32
|
+
// name: "template",
|
|
33
|
+
// title: "Component",
|
|
34
|
+
// initialSize: 30,
|
|
35
|
+
// icon: <PuzzleIcon />,
|
|
36
|
+
// noOverflow: true,
|
|
37
|
+
// content: <ComponentEditor allComponents={allComponents} />,
|
|
38
|
+
// },
|
|
39
|
+
// {
|
|
40
|
+
// name: "placeholders",
|
|
41
|
+
// title: "Placeholders",
|
|
42
|
+
// icon: "pi pi-th-large",
|
|
43
|
+
// initialSize: 30,
|
|
44
|
+
// noOverflow: true,
|
|
45
|
+
// content: <PlaceholdersEditor allComponents={allComponents} />,
|
|
46
|
+
// },
|
|
47
|
+
// {
|
|
48
|
+
// name: "rendering",
|
|
49
|
+
// title: "Rendering",
|
|
50
|
+
// icon: "pi pi-palette",
|
|
51
|
+
// initialSize: 40,
|
|
52
|
+
// content: <ComponentRenderingEditor />,
|
|
53
|
+
// noOverflow: true,
|
|
54
|
+
// },
|
|
55
|
+
// ];
|
|
56
|
+
// return (
|
|
57
|
+
// <Splitter className="h-full">
|
|
58
|
+
// <SplitterPanel>
|
|
59
|
+
// <StackedPanels panels={mainPanels} />
|
|
60
|
+
// </SplitterPanel>
|
|
61
|
+
// <SplitterPanel>
|
|
62
|
+
// <PageViewerFrame compareView={false} />
|
|
63
|
+
// </SplitterPanel>
|
|
64
|
+
// </Splitter>
|
|
65
|
+
// );
|
|
70
66
|
}
|
|
@@ -227,21 +227,6 @@ export function About() {
|
|
|
227
227
|
app{" "}
|
|
228
228
|
</p>{" "}
|
|
229
229
|
</div>{" "}
|
|
230
|
-
<div className="rounded-lg bg-gray-50 p-3">
|
|
231
|
-
{" "}
|
|
232
|
-
<div className="mb-2 flex items-center justify-between">
|
|
233
|
-
{" "}
|
|
234
|
-
<h4 className="text-sm font-medium text-gray-700">
|
|
235
|
-
Allotment
|
|
236
|
-
</h4>{" "}
|
|
237
|
-
<span className="text-xs text-gray-500">MIT License</span>{" "}
|
|
238
|
-
</div>{" "}
|
|
239
|
-
<p className="text-xs text-gray-600">
|
|
240
|
-
{" "}
|
|
241
|
-
React split-pane component with support for multiple
|
|
242
|
-
layouts{" "}
|
|
243
|
-
</p>{" "}
|
|
244
|
-
</div>{" "}
|
|
245
230
|
<div className="rounded-lg bg-gray-50 p-3">
|
|
246
231
|
{" "}
|
|
247
232
|
<div className="mb-2 flex items-center justify-between">
|
|
@@ -8,32 +8,34 @@ import { useRichTextProfileParsed } from "./richtext/hooks/useRichTextProfile";
|
|
|
8
8
|
const RichTextEditorComponent = dynamic(
|
|
9
9
|
() =>
|
|
10
10
|
import("./RichTextEditorComponent").then(
|
|
11
|
-
(dnd) => dnd.RichTextEditorComponent
|
|
11
|
+
(dnd) => dnd.RichTextEditorComponent,
|
|
12
12
|
),
|
|
13
|
-
{ ssr: false }
|
|
13
|
+
{ ssr: false },
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
export function RichTextEditor({
|
|
17
17
|
field,
|
|
18
18
|
readOnly,
|
|
19
19
|
updateFieldValue,
|
|
20
|
+
isFocusedField,
|
|
20
21
|
}: {
|
|
21
22
|
field: RichTextField;
|
|
22
23
|
readOnly?: boolean;
|
|
23
24
|
updateFieldValue?: (value: string) => void;
|
|
25
|
+
isFocusedField: boolean;
|
|
24
26
|
}) {
|
|
25
27
|
const profilePath = field.customProperties?.profile;
|
|
26
|
-
|
|
28
|
+
|
|
27
29
|
// Use the simplified profile hook - this provides service-level caching of parsed profiles
|
|
28
30
|
const { profile, loading, error } = useRichTextProfileParsed(
|
|
29
31
|
profilePath,
|
|
30
|
-
getRichTextProfile
|
|
32
|
+
getRichTextProfile,
|
|
31
33
|
);
|
|
32
34
|
|
|
33
35
|
// Show loading state while profile is being fetched
|
|
34
36
|
if (loading) {
|
|
35
37
|
return (
|
|
36
|
-
<div style={{ padding:
|
|
38
|
+
<div style={{ padding: "8px", color: "#666" }}>
|
|
37
39
|
Loading editor profile...
|
|
38
40
|
</div>
|
|
39
41
|
);
|
|
@@ -42,18 +44,19 @@ export function RichTextEditor({
|
|
|
42
44
|
// Show error state if profile failed to load
|
|
43
45
|
if (error) {
|
|
44
46
|
return (
|
|
45
|
-
<div style={{ padding:
|
|
47
|
+
<div style={{ padding: "8px", color: "#d32f2f" }}>
|
|
46
48
|
Error loading RTE profile from {profilePath}: {error.message}
|
|
47
49
|
</div>
|
|
48
50
|
);
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
return (
|
|
52
|
-
<RichTextEditorComponent
|
|
53
|
-
field={field}
|
|
54
|
-
readOnly={readOnly}
|
|
55
|
-
profile={profile}
|
|
54
|
+
<RichTextEditorComponent
|
|
55
|
+
field={field}
|
|
56
|
+
readOnly={readOnly}
|
|
57
|
+
profile={profile}
|
|
56
58
|
updateFieldValue={updateFieldValue}
|
|
59
|
+
showControls={isFocusedField}
|
|
57
60
|
/>
|
|
58
61
|
);
|
|
59
62
|
}
|