@alpaca-editor/core 1.0.4017 → 1.0.4026
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/SimpleLanguageSelector.d.ts +2 -1
- package/dist/components/SimpleLanguageSelector.js +9 -2
- package/dist/components/SimpleLanguageSelector.js.map +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +3 -1
- package/dist/components/ui/tooltip.js +2 -2
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/config/config.js +4 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +2 -0
- package/dist/editor/ContentTree.js +1 -1
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/ContextMenu.js +26 -0
- package/dist/editor/ContextMenu.js.map +1 -1
- package/dist/editor/FieldHistory.js +1 -1
- package/dist/editor/FieldHistory.js.map +1 -1
- package/dist/editor/FieldListField.js +2 -2
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/Terminal.js +3 -1
- package/dist/editor/Terminal.js.map +1 -1
- package/dist/editor/ai/Agents.js +19 -10
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiResponseMessage.js +63 -5
- package/dist/editor/ai/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/AiTerminal.js +7 -7
- package/dist/editor/ai/AiTerminal.js.map +1 -1
- package/dist/editor/ai/AiToolCall.js +3 -3
- package/dist/editor/ai/AiToolCall.js.map +1 -1
- package/dist/editor/client/EditorClient.js +5 -1
- package/dist/editor/client/EditorClient.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +2 -0
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/operations.d.ts +1 -0
- package/dist/editor/client/operations.js +7 -0
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +1 -1
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/field-types/ImageFieldEditor.js +1 -1
- package/dist/editor/field-types/ImageFieldEditor.js.map +1 -1
- package/dist/editor/field-types/MultiLineText.js +1 -1
- package/dist/editor/field-types/MultiLineText.js.map +1 -1
- package/dist/editor/field-types/PictureFieldEditor.js +1 -1
- package/dist/editor/field-types/PictureFieldEditor.js.map +1 -1
- package/dist/editor/field-types/RawEditor.js +1 -1
- package/dist/editor/field-types/RawEditor.js.map +1 -1
- package/dist/editor/field-types/RichTextEditorComponent.js +16 -17
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
- package/dist/editor/field-types/SingleLineText.js +1 -1
- package/dist/editor/field-types/SingleLineText.js.map +1 -1
- package/dist/editor/field-types/richtext/components/SimpleDropdown.d.ts +18 -0
- package/dist/editor/field-types/richtext/components/SimpleDropdown.js +71 -0
- package/dist/editor/field-types/richtext/components/SimpleDropdown.js.map +1 -0
- package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.d.ts +5 -0
- package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.js +359 -0
- package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.js.map +1 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbar.d.ts +16 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbar.js +181 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbar.js.map +1 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbarButton.d.ts +9 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbarButton.js +14 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbarButton.js.map +1 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.d.ts +4 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.js +193 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.js.map +1 -0
- package/dist/editor/field-types/richtext/index.d.ts +6 -5
- package/dist/editor/field-types/richtext/index.js +6 -5
- package/dist/editor/field-types/richtext/index.js.map +1 -1
- package/dist/editor/field-types/richtext/types.d.ts +16 -16
- package/dist/editor/field-types/richtext/types.js +84 -84
- package/dist/editor/field-types/richtext/types.js.map +1 -1
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +1 -1
- package/dist/editor/page-editor-chrome/CommentHighlighting.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js +5 -5
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +3 -2
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +14 -4
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/aiService.js +1 -0
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/page-wizard/PageWizard.d.ts +2 -0
- package/dist/page-wizard/PageWizard.js +6 -13
- package/dist/page-wizard/PageWizard.js.map +1 -1
- package/dist/page-wizard/WizardSteps.js +3 -1
- package/dist/page-wizard/WizardSteps.js.map +1 -1
- package/dist/page-wizard/service.d.ts +1 -0
- package/dist/page-wizard/service.js +7 -0
- package/dist/page-wizard/service.js.map +1 -1
- package/dist/page-wizard/steps/ContentStep.js +210 -33
- package/dist/page-wizard/steps/ContentStep.js.map +1 -1
- package/dist/page-wizard/steps/FindItemsStep.js +11 -3
- package/dist/page-wizard/steps/FindItemsStep.js.map +1 -1
- package/dist/page-wizard/steps/LayoutStep.js +1 -1
- package/dist/page-wizard/steps/LayoutStep.js.map +1 -1
- package/dist/page-wizard/steps/MetaDataStep.js +1 -1
- package/dist/page-wizard/steps/MetaDataStep.js.map +1 -1
- package/dist/page-wizard/steps/SchottSelectImagesStep.d.ts +2 -0
- package/dist/page-wizard/steps/SchottSelectImagesStep.js +55 -0
- package/dist/page-wizard/steps/SchottSelectImagesStep.js.map +1 -0
- package/dist/page-wizard/steps/StructureStep.js +20 -5
- package/dist/page-wizard/steps/StructureStep.js.map +1 -1
- package/dist/page-wizard/steps/TranslateStep.d.ts +2 -0
- package/dist/page-wizard/steps/TranslateStep.js +413 -0
- package/dist/page-wizard/steps/TranslateStep.js.map +1 -0
- package/dist/page-wizard/utils/dataAccessor.d.ts +7 -0
- package/dist/page-wizard/utils/dataAccessor.js +76 -0
- package/dist/page-wizard/utils/dataAccessor.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/splash-screen/NewPage.js +5 -4
- package/dist/splash-screen/NewPage.js.map +1 -1
- package/dist/splash-screen/OpenPage.js +2 -1
- package/dist/splash-screen/OpenPage.js.map +1 -1
- package/dist/splash-screen/RecentPages.js +3 -1
- package/dist/splash-screen/RecentPages.js.map +1 -1
- package/dist/styles.css +57 -0
- package/package.json +5 -4
- package/src/components/SimpleLanguageSelector.tsx +11 -1
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/tooltip.tsx +3 -2
- package/src/config/config.tsx +4 -0
- package/src/config/types.ts +6 -0
- package/src/editor/ContentTree.tsx +1 -1
- package/src/editor/ContextMenu.tsx +39 -0
- package/src/editor/FieldHistory.tsx +1 -1
- package/src/editor/FieldListField.tsx +2 -6
- package/src/editor/Terminal.tsx +5 -1
- package/src/editor/ai/Agents.tsx +27 -16
- package/src/editor/ai/AiResponseMessage.tsx +138 -23
- package/src/editor/ai/AiTerminal.tsx +43 -29
- package/src/editor/ai/AiToolCall.tsx +14 -4
- package/src/editor/client/EditorClient.tsx +9 -1
- package/src/editor/client/editContext.ts +2 -0
- package/src/editor/client/operations.ts +9 -0
- package/src/editor/commands/componentCommands.tsx +1 -1
- package/src/editor/field-types/ImageFieldEditor.tsx +1 -0
- package/src/editor/field-types/MultiLineText.tsx +1 -0
- package/src/editor/field-types/PictureFieldEditor.tsx +1 -0
- package/src/editor/field-types/RawEditor.tsx +1 -0
- package/src/editor/field-types/RichTextEditorComponent.tsx +27 -25
- package/src/editor/field-types/SingleLineText.tsx +1 -0
- package/src/editor/field-types/richtext/components/SimpleDropdown.tsx +165 -0
- package/src/editor/field-types/richtext/components/SimpleRichTextEditor.css +261 -0
- package/src/editor/field-types/richtext/components/SimpleRichTextEditor.tsx +505 -0
- package/src/editor/field-types/richtext/components/SimpleToolbar.tsx +362 -0
- package/src/editor/field-types/richtext/components/SimpleToolbarButton.tsx +36 -0
- package/src/editor/field-types/richtext/contextMenuFactory.tsx +264 -0
- package/src/editor/field-types/richtext/index.ts +6 -5
- package/src/editor/field-types/richtext/types.ts +168 -148
- package/src/editor/page-editor-chrome/CommentHighlighting.tsx +1 -1
- package/src/editor/page-editor-chrome/FrameMenu.tsx +16 -11
- package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +1 -1
- package/src/editor/page-viewer/PageViewerFrame.tsx +4 -3
- package/src/editor/services/agentService.ts +16 -5
- package/src/editor/services/aiService.ts +2 -0
- package/src/page-wizard/PageWizard.tsx +10 -13
- package/src/page-wizard/WizardSteps.tsx +3 -1
- package/src/page-wizard/service.ts +11 -0
- package/src/page-wizard/steps/ContentStep.tsx +376 -43
- package/src/page-wizard/steps/FindItemsStep.tsx +23 -3
- package/src/page-wizard/steps/LayoutStep.tsx +1 -1
- package/src/page-wizard/steps/MetaDataStep.tsx +1 -1
- package/src/page-wizard/steps/SchottSelectImagesStep.tsx +141 -0
- package/src/page-wizard/steps/StructureStep.tsx +40 -5
- package/src/page-wizard/steps/TranslateStep.tsx +772 -0
- package/src/page-wizard/utils/dataAccessor.ts +85 -0
- package/src/revision.ts +2 -2
- package/src/splash-screen/NewPage.tsx +18 -3
- package/src/splash-screen/OpenPage.tsx +14 -1
- package/src/splash-screen/RecentPages.tsx +4 -2
- package/tsconfig.build.json +1 -0
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
import { BaseEditor, Editor } from
|
|
2
|
-
import { ReactEditor } from
|
|
3
|
-
import React, { JSX } from
|
|
4
|
-
import { Link } from
|
|
5
|
-
import { HistoryEditor } from
|
|
6
|
-
import { Field } from
|
|
1
|
+
import { BaseEditor, Editor } from "slate";
|
|
2
|
+
import { ReactEditor } from "slate-react";
|
|
3
|
+
import React, { JSX } from "react";
|
|
4
|
+
import { Link } from "../../LinkEditorDialog";
|
|
5
|
+
import { HistoryEditor } from "slate-history";
|
|
6
|
+
import { Field } from "../../pageModel";
|
|
7
7
|
|
|
8
|
-
declare module
|
|
8
|
+
declare module "slate" {
|
|
9
9
|
interface CustomTypes {
|
|
10
|
-
Editor: BaseEditor &
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
toggleBlock(format: string): void;
|
|
17
|
-
|
|
18
|
-
isAlignActive(align: string): boolean;
|
|
19
|
-
toggleAlign(align: string): void;
|
|
10
|
+
Editor: BaseEditor &
|
|
11
|
+
ReactEditor &
|
|
12
|
+
HistoryEditor & {
|
|
13
|
+
// Plugin methods
|
|
14
|
+
isMarkActive(format: string): boolean;
|
|
15
|
+
toggleMark(format: string): void;
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
isBlockActive(format: string): boolean;
|
|
18
|
+
toggleBlock(format: string): void;
|
|
19
|
+
|
|
20
|
+
isAlignActive(align: string): boolean;
|
|
21
|
+
toggleAlign(align: string): void;
|
|
22
|
+
|
|
23
|
+
isLinkActive(): boolean;
|
|
24
|
+
insertLink(options?: {
|
|
25
|
+
onOpenLinkDialog?: (callback: (link: any) => void) => void;
|
|
26
|
+
}): void;
|
|
27
|
+
|
|
28
|
+
isListActive(listType?: "unordered" | "ordered"): boolean;
|
|
29
|
+
toggleList(listType: "unordered" | "ordered"): void;
|
|
30
|
+
indentList(): void;
|
|
31
|
+
outdentList(): void;
|
|
32
|
+
};
|
|
33
|
+
Element: CustomElement;
|
|
34
|
+
Text: CustomText;
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -42,40 +46,40 @@ export type CustomText = {
|
|
|
42
46
|
superscript?: boolean;
|
|
43
47
|
extrabold?: boolean;
|
|
44
48
|
isRawHtml?: boolean; // Flag to indicate this text should be preserved as raw HTML
|
|
45
|
-
}
|
|
49
|
+
};
|
|
46
50
|
|
|
47
|
-
export type Alignment =
|
|
51
|
+
export type Alignment = "left" | "center" | "right" | "justify";
|
|
48
52
|
|
|
49
53
|
// Generic element that can have any type
|
|
50
54
|
export type CustomElement = {
|
|
51
55
|
type: string;
|
|
52
56
|
align?: Alignment;
|
|
53
|
-
listType?:
|
|
57
|
+
listType?: "unordered" | "ordered";
|
|
54
58
|
indent?: number;
|
|
55
59
|
children: (CustomText | CustomElement)[];
|
|
56
60
|
[key: string]: any; // For any custom properties
|
|
57
|
-
}
|
|
61
|
+
};
|
|
58
62
|
|
|
59
63
|
// Preserved element type for unsupported HTML elements
|
|
60
64
|
export type PreservedElement = CustomElement & {
|
|
61
|
-
type:
|
|
65
|
+
type: "preserved-element";
|
|
62
66
|
originalTag: string;
|
|
63
67
|
originalHtml: string;
|
|
64
68
|
attributes: Record<string, any>;
|
|
65
|
-
}
|
|
69
|
+
};
|
|
66
70
|
|
|
67
71
|
// Preserved inline element type for unsupported inline HTML elements
|
|
68
72
|
export type PreservedInlineElement = CustomElement & {
|
|
69
|
-
type:
|
|
73
|
+
type: "preserved-inline";
|
|
70
74
|
originalTag: string;
|
|
71
75
|
originalHtml: string;
|
|
72
76
|
attributes: Record<string, any>;
|
|
73
|
-
}
|
|
77
|
+
};
|
|
74
78
|
|
|
75
79
|
export type LinkElement = CustomElement & {
|
|
76
|
-
type:
|
|
80
|
+
type: "link";
|
|
77
81
|
link: Link;
|
|
78
|
-
}
|
|
82
|
+
};
|
|
79
83
|
|
|
80
84
|
export interface ReactSlateProps {
|
|
81
85
|
value?: string;
|
|
@@ -114,156 +118,172 @@ export interface ToolbarButtonProps {
|
|
|
114
118
|
export interface ToolbarGroupConfig {
|
|
115
119
|
id: string;
|
|
116
120
|
label?: string;
|
|
117
|
-
display?:
|
|
121
|
+
display?: "buttons" | "dropdown";
|
|
118
122
|
showIconsOnly?: boolean;
|
|
119
123
|
options: ToolbarOptionConfig[];
|
|
120
124
|
row?: number; // Optional row identifier for grouping
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
export interface ToolbarOptionConfig {
|
|
124
|
-
type:
|
|
128
|
+
type: "mark" | "block" | "alignment" | "link" | "list" | "divider" | string;
|
|
125
129
|
id: string; // Reference to the option in the corresponding collection
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
export type RichTextEditorProfile = {
|
|
129
133
|
toolbar: {
|
|
130
134
|
groups: ToolbarGroupConfig[];
|
|
131
|
-
}
|
|
135
|
+
};
|
|
132
136
|
};
|
|
133
137
|
|
|
134
138
|
// Simplified profile structure that maps directly to Slate capabilities
|
|
135
139
|
export interface SimplifiedProfile {
|
|
136
|
-
marks: string[];
|
|
137
|
-
blocks: string[];
|
|
138
|
-
alignment: string[];
|
|
139
|
-
lists: boolean;
|
|
140
|
-
links: boolean;
|
|
140
|
+
marks: string[]; // ['bold', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', 'extrabold']
|
|
141
|
+
blocks: string[]; // ['paragraph', 'no-tag', 'heading-1', 'heading-2', 'heading-3', 'heading-4', 'heading-5', 'heading-6']
|
|
142
|
+
alignment: string[]; // ['left', 'center', 'right', 'justify']
|
|
143
|
+
lists: boolean; // true if lists are enabled
|
|
144
|
+
links: boolean; // true if links are enabled
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
// Built-in Slate mark configurations
|
|
144
|
-
export const SLATE_MARKS: Record<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
148
|
+
export const SLATE_MARKS: Record<
|
|
149
|
+
string,
|
|
150
|
+
{
|
|
151
|
+
hotkey?: string;
|
|
152
|
+
htmlTag: string;
|
|
153
|
+
label: string;
|
|
154
|
+
icon: string;
|
|
155
|
+
renderHtml: (text: string) => string;
|
|
156
|
+
}
|
|
157
|
+
> = {
|
|
158
|
+
bold: {
|
|
159
|
+
hotkey: "mod+b",
|
|
160
|
+
htmlTag: "strong",
|
|
161
|
+
label: "Bold",
|
|
162
|
+
icon: "𝐁",
|
|
163
|
+
renderHtml: (text: string) => `<strong>${text}</strong>`,
|
|
157
164
|
},
|
|
158
|
-
|
|
159
|
-
hotkey:
|
|
160
|
-
htmlTag:
|
|
161
|
-
label:
|
|
162
|
-
icon:
|
|
163
|
-
renderHtml: (text: string) => `<em>${text}</em
|
|
165
|
+
italic: {
|
|
166
|
+
hotkey: "mod+i",
|
|
167
|
+
htmlTag: "em",
|
|
168
|
+
label: "Italic",
|
|
169
|
+
icon: "𝐼",
|
|
170
|
+
renderHtml: (text: string) => `<em>${text}</em>`,
|
|
164
171
|
},
|
|
165
|
-
|
|
166
|
-
hotkey:
|
|
167
|
-
htmlTag:
|
|
168
|
-
label:
|
|
169
|
-
icon:
|
|
170
|
-
renderHtml: (text: string) => `<u>${text}</u
|
|
172
|
+
underline: {
|
|
173
|
+
hotkey: "mod+u",
|
|
174
|
+
htmlTag: "u",
|
|
175
|
+
label: "Underline",
|
|
176
|
+
icon: "𝐔",
|
|
177
|
+
renderHtml: (text: string) => `<u>${text}</u>`,
|
|
171
178
|
},
|
|
172
|
-
|
|
173
|
-
htmlTag:
|
|
174
|
-
label:
|
|
175
|
-
icon:
|
|
176
|
-
renderHtml: (text: string) => `<s>${text}</s
|
|
179
|
+
strikethrough: {
|
|
180
|
+
htmlTag: "s",
|
|
181
|
+
label: "Strikethrough",
|
|
182
|
+
icon: "𝐒",
|
|
183
|
+
renderHtml: (text: string) => `<s>${text}</s>`,
|
|
177
184
|
},
|
|
178
|
-
|
|
179
|
-
htmlTag:
|
|
180
|
-
label:
|
|
181
|
-
icon:
|
|
182
|
-
renderHtml: (text: string) => `<sub>${text}</sub
|
|
185
|
+
subscript: {
|
|
186
|
+
htmlTag: "sub",
|
|
187
|
+
label: "Subscript",
|
|
188
|
+
icon: "X₂",
|
|
189
|
+
renderHtml: (text: string) => `<sub>${text}</sub>`,
|
|
183
190
|
},
|
|
184
|
-
|
|
185
|
-
htmlTag:
|
|
186
|
-
label:
|
|
187
|
-
icon:
|
|
188
|
-
renderHtml: (text: string) => `<sup>${text}</sup
|
|
191
|
+
superscript: {
|
|
192
|
+
htmlTag: "sup",
|
|
193
|
+
label: "Superscript",
|
|
194
|
+
icon: "X²",
|
|
195
|
+
renderHtml: (text: string) => `<sup>${text}</sup>`,
|
|
196
|
+
},
|
|
197
|
+
extrabold: {
|
|
198
|
+
htmlTag: "span",
|
|
199
|
+
label: "Extra Bold",
|
|
200
|
+
icon: "𝐄𝐁",
|
|
201
|
+
renderHtml: (text: string) => `<span class="extrabold">${text}</span>`,
|
|
189
202
|
},
|
|
190
|
-
'extrabold': {
|
|
191
|
-
htmlTag: 'span',
|
|
192
|
-
label: 'Extra Bold',
|
|
193
|
-
icon: '𝐄𝐁',
|
|
194
|
-
renderHtml: (text: string) => `<span class="extrabold">${text}</span>`
|
|
195
|
-
}
|
|
196
203
|
};
|
|
197
204
|
|
|
198
205
|
// Built-in Slate block configurations
|
|
199
|
-
export const SLATE_BLOCKS: Record<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
export const SLATE_BLOCKS: Record<
|
|
207
|
+
string,
|
|
208
|
+
{
|
|
209
|
+
htmlTag: string;
|
|
210
|
+
label: string;
|
|
211
|
+
icon: string;
|
|
212
|
+
renderHtml: (text: string, alignStyle: string) => string;
|
|
213
|
+
}
|
|
214
|
+
> = {
|
|
215
|
+
paragraph: {
|
|
216
|
+
htmlTag: "p",
|
|
217
|
+
label: "Paragraph",
|
|
218
|
+
icon: "¶",
|
|
219
|
+
renderHtml: (text: string, alignStyle: string) =>
|
|
220
|
+
`<p${alignStyle}>${text}</p>`,
|
|
210
221
|
},
|
|
211
|
-
|
|
212
|
-
htmlTag:
|
|
213
|
-
label:
|
|
214
|
-
icon:
|
|
215
|
-
renderHtml: (text: string, alignStyle: string) => text
|
|
222
|
+
"no-tag": {
|
|
223
|
+
htmlTag: "no-tag",
|
|
224
|
+
label: "Plain Text",
|
|
225
|
+
icon: "T",
|
|
226
|
+
renderHtml: (text: string, alignStyle: string) => text,
|
|
216
227
|
},
|
|
217
|
-
|
|
218
|
-
htmlTag:
|
|
219
|
-
label:
|
|
220
|
-
icon:
|
|
221
|
-
renderHtml: (text: string, alignStyle: string) =>
|
|
228
|
+
"heading-1": {
|
|
229
|
+
htmlTag: "h1",
|
|
230
|
+
label: "Heading 1",
|
|
231
|
+
icon: "H1",
|
|
232
|
+
renderHtml: (text: string, alignStyle: string) =>
|
|
233
|
+
`<h1${alignStyle}>${text}</h1>`,
|
|
222
234
|
},
|
|
223
|
-
|
|
224
|
-
htmlTag:
|
|
225
|
-
label:
|
|
226
|
-
icon:
|
|
227
|
-
renderHtml: (text: string, alignStyle: string) =>
|
|
235
|
+
"heading-2": {
|
|
236
|
+
htmlTag: "h2",
|
|
237
|
+
label: "Heading 2",
|
|
238
|
+
icon: "H2",
|
|
239
|
+
renderHtml: (text: string, alignStyle: string) =>
|
|
240
|
+
`<h2${alignStyle}>${text}</h2>`,
|
|
228
241
|
},
|
|
229
|
-
|
|
230
|
-
htmlTag:
|
|
231
|
-
label:
|
|
232
|
-
icon:
|
|
233
|
-
renderHtml: (text: string, alignStyle: string) =>
|
|
242
|
+
"heading-3": {
|
|
243
|
+
htmlTag: "h3",
|
|
244
|
+
label: "Heading 3",
|
|
245
|
+
icon: "H3",
|
|
246
|
+
renderHtml: (text: string, alignStyle: string) =>
|
|
247
|
+
`<h3${alignStyle}>${text}</h3>`,
|
|
234
248
|
},
|
|
235
|
-
|
|
236
|
-
htmlTag:
|
|
237
|
-
label:
|
|
238
|
-
icon:
|
|
239
|
-
renderHtml: (text: string, alignStyle: string) =>
|
|
249
|
+
"heading-4": {
|
|
250
|
+
htmlTag: "h4",
|
|
251
|
+
label: "Heading 4",
|
|
252
|
+
icon: "H4",
|
|
253
|
+
renderHtml: (text: string, alignStyle: string) =>
|
|
254
|
+
`<h4${alignStyle}>${text}</h4>`,
|
|
240
255
|
},
|
|
241
|
-
|
|
242
|
-
htmlTag:
|
|
243
|
-
label:
|
|
244
|
-
icon:
|
|
245
|
-
renderHtml: (text: string, alignStyle: string) =>
|
|
256
|
+
"heading-5": {
|
|
257
|
+
htmlTag: "h5",
|
|
258
|
+
label: "Heading 5",
|
|
259
|
+
icon: "H5",
|
|
260
|
+
renderHtml: (text: string, alignStyle: string) =>
|
|
261
|
+
`<h5${alignStyle}>${text}</h5>`,
|
|
262
|
+
},
|
|
263
|
+
"heading-6": {
|
|
264
|
+
htmlTag: "h6",
|
|
265
|
+
label: "Heading 6",
|
|
266
|
+
icon: "H6",
|
|
267
|
+
renderHtml: (text: string, alignStyle: string) =>
|
|
268
|
+
`<h6${alignStyle}>${text}</h6>`,
|
|
246
269
|
},
|
|
247
|
-
'heading-6': {
|
|
248
|
-
htmlTag: 'h6',
|
|
249
|
-
label: 'Heading 6',
|
|
250
|
-
icon: 'H6',
|
|
251
|
-
renderHtml: (text: string, alignStyle: string) => `<h6${alignStyle}>${text}</h6>`
|
|
252
|
-
}
|
|
253
270
|
};
|
|
254
271
|
|
|
255
272
|
// Built-in alignment configurations
|
|
256
|
-
export const SLATE_ALIGNMENTS: Record<
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
273
|
+
export const SLATE_ALIGNMENTS: Record<
|
|
274
|
+
string,
|
|
275
|
+
{
|
|
276
|
+
label: string;
|
|
277
|
+
icon: string;
|
|
278
|
+
value: Alignment;
|
|
279
|
+
}
|
|
280
|
+
> = {
|
|
281
|
+
left: { label: "Align Left", icon: "←", value: "left" },
|
|
282
|
+
center: { label: "Align Center", icon: "↔", value: "center" },
|
|
283
|
+
right: { label: "Align Right", icon: "→", value: "right" },
|
|
284
|
+
justify: { label: "Justify", icon: "≡", value: "justify" },
|
|
265
285
|
};
|
|
266
286
|
|
|
267
287
|
export type RichTextField = Field & {
|
|
268
288
|
source: string;
|
|
269
|
-
}
|
|
289
|
+
};
|
|
@@ -185,7 +185,7 @@ export function CommentHighlighting({
|
|
|
185
185
|
: "right-[-18px]",
|
|
186
186
|
)}
|
|
187
187
|
onClick={() => {
|
|
188
|
-
editContext.switchView("
|
|
188
|
+
editContext.switchView("comments");
|
|
189
189
|
editContext?.select([comment.itemId]);
|
|
190
190
|
editContext?.setSelectedComment(comment);
|
|
191
191
|
}}
|
|
@@ -351,22 +351,27 @@ export function FrameMenu({
|
|
|
351
351
|
<GripVertical strokeWidth={1} className="h-4 w-4" />
|
|
352
352
|
{component.name}
|
|
353
353
|
{component.parentPlaceholder?.parentComponent && (
|
|
354
|
-
<
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
354
|
+
<Tooltip delayDuration={500}>
|
|
355
|
+
<TooltipTrigger asChild>
|
|
356
|
+
<span
|
|
357
|
+
className="cursor-pointer opacity-0 transition-opacity group-hover:opacity-100"
|
|
358
|
+
onClick={() => {
|
|
359
|
+
editContext.select([
|
|
360
|
+
component.parentPlaceholder?.parentComponent.id || "",
|
|
361
|
+
]);
|
|
362
|
+
}}
|
|
363
|
+
>
|
|
364
|
+
<ArrowUpFromDot height={14} width={14} />
|
|
365
|
+
</span>
|
|
366
|
+
</TooltipTrigger>
|
|
367
|
+
<TooltipContent>Select parent</TooltipContent>
|
|
368
|
+
</Tooltip>
|
|
364
369
|
)}
|
|
365
370
|
</div>
|
|
366
371
|
{editContext.mode === "edit" && (
|
|
367
372
|
<div className="flex items-center gap-2.5 text-sm">
|
|
368
373
|
{buttons.map((b, i) => (
|
|
369
|
-
<Tooltip key={i}>
|
|
374
|
+
<Tooltip key={i} delayDuration={500}>
|
|
370
375
|
<TooltipTrigger asChild>
|
|
371
376
|
<div
|
|
372
377
|
className="cursor-pointer hover:text-gray-200"
|
|
@@ -151,7 +151,7 @@ export function PlaceholderDropZone({
|
|
|
151
151
|
<div
|
|
152
152
|
className={cn(
|
|
153
153
|
isHovering
|
|
154
|
-
? "z-30 h-20 w-
|
|
154
|
+
? "z-30 h-20 w-15 shadow-xl"
|
|
155
155
|
: "z-30 h-10 w-10 hover:scale-[1.1]",
|
|
156
156
|
"test-ph-dropzone tour-placeholder-dropzone absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-blue-500 p-2 text-center text-sm text-white opacity-100 transition-all duration-300 ease-in-out",
|
|
157
157
|
className,
|
|
@@ -171,11 +171,12 @@ export function PageViewerFrame({
|
|
|
171
171
|
)
|
|
172
172
|
return;
|
|
173
173
|
|
|
174
|
-
const
|
|
174
|
+
const urlPath =
|
|
175
175
|
editContext.mode === "preview"
|
|
176
176
|
? pageViewContext.previewUrl
|
|
177
|
-
: pageViewContext.editUrl
|
|
178
|
-
|
|
177
|
+
: pageViewContext.editUrl;
|
|
178
|
+
|
|
179
|
+
const renderUrl = new URL(urlPath, window.location.origin);
|
|
179
180
|
renderUrl.searchParams.set("edit_rev", editContext.revision ?? uuid());
|
|
180
181
|
|
|
181
182
|
if (iframeRef.current?.contentWindow?.requestRefresh) {
|
|
@@ -32,11 +32,8 @@ export interface AgentChatMessage {
|
|
|
32
32
|
role: string;
|
|
33
33
|
content: string;
|
|
34
34
|
name: string;
|
|
35
|
-
toolCallId?: string;
|
|
36
|
-
|
|
37
|
-
functionArguments?: string;
|
|
38
|
-
functionResult?: any;
|
|
39
|
-
functionError?: string;
|
|
35
|
+
toolCallId?: string; // For tool result messages that reference a specific tool call
|
|
36
|
+
messageType?: string; // content, tool_result
|
|
40
37
|
isCompleted: boolean;
|
|
41
38
|
model?: string;
|
|
42
39
|
tokensUsed: number;
|
|
@@ -47,6 +44,20 @@ export interface AgentChatMessage {
|
|
|
47
44
|
editOperations?: any[];
|
|
48
45
|
longRunningTaskIds?: string[];
|
|
49
46
|
metadata?: string;
|
|
47
|
+
toolCalls?: AgentChatToolCall[]; // Tool calls associated with this message
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface AgentChatToolCall {
|
|
51
|
+
id: string;
|
|
52
|
+
messageId: string;
|
|
53
|
+
toolCallId: string; // The tool call ID from the AI response
|
|
54
|
+
functionName: string;
|
|
55
|
+
functionArguments?: string;
|
|
56
|
+
functionResult?: any;
|
|
57
|
+
functionError?: string;
|
|
58
|
+
isCompleted: boolean;
|
|
59
|
+
responseTimeMs?: number;
|
|
60
|
+
createdDate: string;
|
|
50
61
|
}
|
|
51
62
|
|
|
52
63
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
import { useEditContext } from "../editor/client/editContext";
|
|
3
|
-
import {
|
|
3
|
+
import { getWizard } from "./service";
|
|
4
4
|
|
|
5
5
|
import { WizardSteps } from "./WizardSteps";
|
|
6
6
|
import { Thumbnail } from "../editor/services/contentService";
|
|
7
7
|
import { Spinner } from "../editor/ui/Spinner";
|
|
8
|
+
import { ItemDescriptor } from "../editor/pageModel";
|
|
8
9
|
|
|
9
10
|
export type Wizard = {
|
|
10
11
|
id: string;
|
|
@@ -62,6 +63,7 @@ export type WizardStep = {
|
|
|
62
63
|
|
|
63
64
|
export type WizardData = {
|
|
64
65
|
[key: string]: any;
|
|
66
|
+
currentItem?: ItemDescriptor;
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
export type WizardPageModel = {
|
|
@@ -94,7 +96,7 @@ export type WizardField = {
|
|
|
94
96
|
export function PageWizard() {
|
|
95
97
|
const editContext = useEditContext();
|
|
96
98
|
const [wizard, setWizard] = useState<Wizard | null>(null);
|
|
97
|
-
const [parentItem, setParentItem] = useState<
|
|
99
|
+
const [parentItem, setParentItem] = useState<ItemDescriptor | null>(null);
|
|
98
100
|
const [isLoading, setIsLoading] = useState(true);
|
|
99
101
|
|
|
100
102
|
useEffect(() => {
|
|
@@ -117,20 +119,15 @@ export function PageWizard() {
|
|
|
117
119
|
|
|
118
120
|
setIsLoading(true);
|
|
119
121
|
try {
|
|
120
|
-
const
|
|
122
|
+
const foundWizard = await getWizard(
|
|
123
|
+
wizardId,
|
|
121
124
|
editContext.contentEditorItem.descriptor,
|
|
122
125
|
);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
setWizard(foundWizard);
|
|
126
|
-
setParentItem(editContext.contentEditorItem.descriptor);
|
|
127
|
-
} else {
|
|
128
|
-
console.log("PageWizard - Wizard not found:", wizardId);
|
|
129
|
-
// Only switch away if we actually looked for the wizard and didn't find it
|
|
130
|
-
editContext?.switchView("content-editor", { skipConfirmation: true });
|
|
131
|
-
}
|
|
126
|
+
setWizard(foundWizard);
|
|
127
|
+
setParentItem(editContext.contentEditorItem.descriptor);
|
|
132
128
|
} catch (error) {
|
|
133
|
-
console.error("PageWizard: Error loading
|
|
129
|
+
console.error("PageWizard: Error loading wizard:", error);
|
|
130
|
+
// If the wizard couldn't be loaded (not found, not valid for context, etc.)
|
|
134
131
|
editContext?.switchView("content-editor", { skipConfirmation: true });
|
|
135
132
|
} finally {
|
|
136
133
|
setIsLoading(false);
|
|
@@ -318,7 +318,9 @@ function MobileNavigationButtons({
|
|
|
318
318
|
export function WizardSteps({ wizard, parentItem }: WizardStepsProps) {
|
|
319
319
|
// Local state management instead of pageWizard context
|
|
320
320
|
const [currentStepIndex, setCurrentStepIndex] = useState(0);
|
|
321
|
-
const [data, setData] = useState<WizardData>({
|
|
321
|
+
const [data, setData] = useState<WizardData>({
|
|
322
|
+
currentItem: parentItem,
|
|
323
|
+
});
|
|
322
324
|
const [pageModel, setPageModel] = useState<WizardPageModel>({
|
|
323
325
|
components: [],
|
|
324
326
|
name: "",
|
|
@@ -11,6 +11,17 @@ export async function getWizards(
|
|
|
11
11
|
return result.data as Wizard[] | [];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export async function getWizard(
|
|
15
|
+
wizardId: string,
|
|
16
|
+
parentItem: ItemDescriptor,
|
|
17
|
+
): Promise<Wizard> {
|
|
18
|
+
const result = await post("/alpaca/editor/page-wizard/getWizard", {
|
|
19
|
+
wizardId,
|
|
20
|
+
parentItem,
|
|
21
|
+
});
|
|
22
|
+
return result.data as Wizard;
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
export function createWizardAiContext({
|
|
15
26
|
editContext,
|
|
16
27
|
}: {
|