@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.
Files changed (173) hide show
  1. package/dist/components/SimpleLanguageSelector.d.ts +2 -1
  2. package/dist/components/SimpleLanguageSelector.js +9 -2
  3. package/dist/components/SimpleLanguageSelector.js.map +1 -1
  4. package/dist/components/ui/input.js +1 -1
  5. package/dist/components/ui/input.js.map +1 -1
  6. package/dist/components/ui/tooltip.d.ts +3 -1
  7. package/dist/components/ui/tooltip.js +2 -2
  8. package/dist/components/ui/tooltip.js.map +1 -1
  9. package/dist/config/config.js +4 -0
  10. package/dist/config/config.js.map +1 -1
  11. package/dist/config/types.d.ts +2 -0
  12. package/dist/editor/ContentTree.js +1 -1
  13. package/dist/editor/ContentTree.js.map +1 -1
  14. package/dist/editor/ContextMenu.js +26 -0
  15. package/dist/editor/ContextMenu.js.map +1 -1
  16. package/dist/editor/FieldHistory.js +1 -1
  17. package/dist/editor/FieldHistory.js.map +1 -1
  18. package/dist/editor/FieldListField.js +2 -2
  19. package/dist/editor/FieldListField.js.map +1 -1
  20. package/dist/editor/Terminal.js +3 -1
  21. package/dist/editor/Terminal.js.map +1 -1
  22. package/dist/editor/ai/Agents.js +19 -10
  23. package/dist/editor/ai/Agents.js.map +1 -1
  24. package/dist/editor/ai/AiResponseMessage.js +63 -5
  25. package/dist/editor/ai/AiResponseMessage.js.map +1 -1
  26. package/dist/editor/ai/AiTerminal.js +7 -7
  27. package/dist/editor/ai/AiTerminal.js.map +1 -1
  28. package/dist/editor/ai/AiToolCall.js +3 -3
  29. package/dist/editor/ai/AiToolCall.js.map +1 -1
  30. package/dist/editor/client/EditorClient.js +5 -1
  31. package/dist/editor/client/EditorClient.js.map +1 -1
  32. package/dist/editor/client/editContext.d.ts +2 -0
  33. package/dist/editor/client/editContext.js.map +1 -1
  34. package/dist/editor/client/operations.d.ts +1 -0
  35. package/dist/editor/client/operations.js +7 -0
  36. package/dist/editor/client/operations.js.map +1 -1
  37. package/dist/editor/commands/componentCommands.js +1 -1
  38. package/dist/editor/commands/componentCommands.js.map +1 -1
  39. package/dist/editor/field-types/ImageFieldEditor.js +1 -1
  40. package/dist/editor/field-types/ImageFieldEditor.js.map +1 -1
  41. package/dist/editor/field-types/MultiLineText.js +1 -1
  42. package/dist/editor/field-types/MultiLineText.js.map +1 -1
  43. package/dist/editor/field-types/PictureFieldEditor.js +1 -1
  44. package/dist/editor/field-types/PictureFieldEditor.js.map +1 -1
  45. package/dist/editor/field-types/RawEditor.js +1 -1
  46. package/dist/editor/field-types/RawEditor.js.map +1 -1
  47. package/dist/editor/field-types/RichTextEditorComponent.js +16 -17
  48. package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
  49. package/dist/editor/field-types/SingleLineText.js +1 -1
  50. package/dist/editor/field-types/SingleLineText.js.map +1 -1
  51. package/dist/editor/field-types/richtext/components/SimpleDropdown.d.ts +18 -0
  52. package/dist/editor/field-types/richtext/components/SimpleDropdown.js +71 -0
  53. package/dist/editor/field-types/richtext/components/SimpleDropdown.js.map +1 -0
  54. package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.d.ts +5 -0
  55. package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.js +359 -0
  56. package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.js.map +1 -0
  57. package/dist/editor/field-types/richtext/components/SimpleToolbar.d.ts +16 -0
  58. package/dist/editor/field-types/richtext/components/SimpleToolbar.js +181 -0
  59. package/dist/editor/field-types/richtext/components/SimpleToolbar.js.map +1 -0
  60. package/dist/editor/field-types/richtext/components/SimpleToolbarButton.d.ts +9 -0
  61. package/dist/editor/field-types/richtext/components/SimpleToolbarButton.js +14 -0
  62. package/dist/editor/field-types/richtext/components/SimpleToolbarButton.js.map +1 -0
  63. package/dist/editor/field-types/richtext/contextMenuFactory.d.ts +4 -0
  64. package/dist/editor/field-types/richtext/contextMenuFactory.js +193 -0
  65. package/dist/editor/field-types/richtext/contextMenuFactory.js.map +1 -0
  66. package/dist/editor/field-types/richtext/index.d.ts +6 -5
  67. package/dist/editor/field-types/richtext/index.js +6 -5
  68. package/dist/editor/field-types/richtext/index.js.map +1 -1
  69. package/dist/editor/field-types/richtext/types.d.ts +16 -16
  70. package/dist/editor/field-types/richtext/types.js +84 -84
  71. package/dist/editor/field-types/richtext/types.js.map +1 -1
  72. package/dist/editor/page-editor-chrome/CommentHighlighting.js +1 -1
  73. package/dist/editor/page-editor-chrome/CommentHighlighting.js.map +1 -1
  74. package/dist/editor/page-editor-chrome/FrameMenu.js +5 -5
  75. package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
  76. package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +1 -1
  77. package/dist/editor/page-viewer/PageViewerFrame.js +3 -2
  78. package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
  79. package/dist/editor/services/agentService.d.ts +14 -4
  80. package/dist/editor/services/agentService.js.map +1 -1
  81. package/dist/editor/services/aiService.js +1 -0
  82. package/dist/editor/services/aiService.js.map +1 -1
  83. package/dist/page-wizard/PageWizard.d.ts +2 -0
  84. package/dist/page-wizard/PageWizard.js +6 -13
  85. package/dist/page-wizard/PageWizard.js.map +1 -1
  86. package/dist/page-wizard/WizardSteps.js +3 -1
  87. package/dist/page-wizard/WizardSteps.js.map +1 -1
  88. package/dist/page-wizard/service.d.ts +1 -0
  89. package/dist/page-wizard/service.js +7 -0
  90. package/dist/page-wizard/service.js.map +1 -1
  91. package/dist/page-wizard/steps/ContentStep.js +210 -33
  92. package/dist/page-wizard/steps/ContentStep.js.map +1 -1
  93. package/dist/page-wizard/steps/FindItemsStep.js +11 -3
  94. package/dist/page-wizard/steps/FindItemsStep.js.map +1 -1
  95. package/dist/page-wizard/steps/LayoutStep.js +1 -1
  96. package/dist/page-wizard/steps/LayoutStep.js.map +1 -1
  97. package/dist/page-wizard/steps/MetaDataStep.js +1 -1
  98. package/dist/page-wizard/steps/MetaDataStep.js.map +1 -1
  99. package/dist/page-wizard/steps/SchottSelectImagesStep.d.ts +2 -0
  100. package/dist/page-wizard/steps/SchottSelectImagesStep.js +55 -0
  101. package/dist/page-wizard/steps/SchottSelectImagesStep.js.map +1 -0
  102. package/dist/page-wizard/steps/StructureStep.js +20 -5
  103. package/dist/page-wizard/steps/StructureStep.js.map +1 -1
  104. package/dist/page-wizard/steps/TranslateStep.d.ts +2 -0
  105. package/dist/page-wizard/steps/TranslateStep.js +413 -0
  106. package/dist/page-wizard/steps/TranslateStep.js.map +1 -0
  107. package/dist/page-wizard/utils/dataAccessor.d.ts +7 -0
  108. package/dist/page-wizard/utils/dataAccessor.js +76 -0
  109. package/dist/page-wizard/utils/dataAccessor.js.map +1 -1
  110. package/dist/revision.d.ts +2 -2
  111. package/dist/revision.js +2 -2
  112. package/dist/splash-screen/NewPage.js +5 -4
  113. package/dist/splash-screen/NewPage.js.map +1 -1
  114. package/dist/splash-screen/OpenPage.js +2 -1
  115. package/dist/splash-screen/OpenPage.js.map +1 -1
  116. package/dist/splash-screen/RecentPages.js +3 -1
  117. package/dist/splash-screen/RecentPages.js.map +1 -1
  118. package/dist/styles.css +57 -0
  119. package/package.json +5 -4
  120. package/src/components/SimpleLanguageSelector.tsx +11 -1
  121. package/src/components/ui/input.tsx +1 -1
  122. package/src/components/ui/tooltip.tsx +3 -2
  123. package/src/config/config.tsx +4 -0
  124. package/src/config/types.ts +6 -0
  125. package/src/editor/ContentTree.tsx +1 -1
  126. package/src/editor/ContextMenu.tsx +39 -0
  127. package/src/editor/FieldHistory.tsx +1 -1
  128. package/src/editor/FieldListField.tsx +2 -6
  129. package/src/editor/Terminal.tsx +5 -1
  130. package/src/editor/ai/Agents.tsx +27 -16
  131. package/src/editor/ai/AiResponseMessage.tsx +138 -23
  132. package/src/editor/ai/AiTerminal.tsx +43 -29
  133. package/src/editor/ai/AiToolCall.tsx +14 -4
  134. package/src/editor/client/EditorClient.tsx +9 -1
  135. package/src/editor/client/editContext.ts +2 -0
  136. package/src/editor/client/operations.ts +9 -0
  137. package/src/editor/commands/componentCommands.tsx +1 -1
  138. package/src/editor/field-types/ImageFieldEditor.tsx +1 -0
  139. package/src/editor/field-types/MultiLineText.tsx +1 -0
  140. package/src/editor/field-types/PictureFieldEditor.tsx +1 -0
  141. package/src/editor/field-types/RawEditor.tsx +1 -0
  142. package/src/editor/field-types/RichTextEditorComponent.tsx +27 -25
  143. package/src/editor/field-types/SingleLineText.tsx +1 -0
  144. package/src/editor/field-types/richtext/components/SimpleDropdown.tsx +165 -0
  145. package/src/editor/field-types/richtext/components/SimpleRichTextEditor.css +261 -0
  146. package/src/editor/field-types/richtext/components/SimpleRichTextEditor.tsx +505 -0
  147. package/src/editor/field-types/richtext/components/SimpleToolbar.tsx +362 -0
  148. package/src/editor/field-types/richtext/components/SimpleToolbarButton.tsx +36 -0
  149. package/src/editor/field-types/richtext/contextMenuFactory.tsx +264 -0
  150. package/src/editor/field-types/richtext/index.ts +6 -5
  151. package/src/editor/field-types/richtext/types.ts +168 -148
  152. package/src/editor/page-editor-chrome/CommentHighlighting.tsx +1 -1
  153. package/src/editor/page-editor-chrome/FrameMenu.tsx +16 -11
  154. package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +1 -1
  155. package/src/editor/page-viewer/PageViewerFrame.tsx +4 -3
  156. package/src/editor/services/agentService.ts +16 -5
  157. package/src/editor/services/aiService.ts +2 -0
  158. package/src/page-wizard/PageWizard.tsx +10 -13
  159. package/src/page-wizard/WizardSteps.tsx +3 -1
  160. package/src/page-wizard/service.ts +11 -0
  161. package/src/page-wizard/steps/ContentStep.tsx +376 -43
  162. package/src/page-wizard/steps/FindItemsStep.tsx +23 -3
  163. package/src/page-wizard/steps/LayoutStep.tsx +1 -1
  164. package/src/page-wizard/steps/MetaDataStep.tsx +1 -1
  165. package/src/page-wizard/steps/SchottSelectImagesStep.tsx +141 -0
  166. package/src/page-wizard/steps/StructureStep.tsx +40 -5
  167. package/src/page-wizard/steps/TranslateStep.tsx +772 -0
  168. package/src/page-wizard/utils/dataAccessor.ts +85 -0
  169. package/src/revision.ts +2 -2
  170. package/src/splash-screen/NewPage.tsx +18 -3
  171. package/src/splash-screen/OpenPage.tsx +14 -1
  172. package/src/splash-screen/RecentPages.tsx +4 -2
  173. package/tsconfig.build.json +1 -0
@@ -1,33 +1,37 @@
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';
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 'slate' {
8
+ declare module "slate" {
9
9
  interface CustomTypes {
10
- Editor: BaseEditor & ReactEditor & HistoryEditor & {
11
- // Plugin methods
12
- isMarkActive(format: string): boolean;
13
- toggleMark(format: string): void;
14
-
15
- isBlockActive(format: string): boolean;
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
- isLinkActive(): boolean;
22
- insertLink(options?: { onOpenLinkDialog?: (callback: (link: any) => void) => void }): void;
23
-
24
- isListActive(listType?: 'unordered' | 'ordered'): boolean;
25
- toggleList(listType: 'unordered' | 'ordered'): void;
26
- indentList(): void;
27
- outdentList(): void;
28
- }
29
- Element: CustomElement
30
- Text: CustomText
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 = 'left' | 'center' | 'right' | 'justify';
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?: 'unordered' | 'ordered';
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: 'preserved-element';
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: 'preserved-inline';
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: 'link';
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?: 'buttons' | 'dropdown';
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: 'mark' | 'block' | 'alignment' | 'link' | 'list' | 'divider' | string;
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[]; // ['bold', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', 'extrabold']
137
- blocks: string[]; // ['paragraph', 'no-tag', 'heading-1', 'heading-2', 'heading-3', 'heading-4', 'heading-5', 'heading-6']
138
- alignment: string[]; // ['left', 'center', 'right', 'justify']
139
- lists: boolean; // true if lists are enabled
140
- links: boolean; // true if links are enabled
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<string, {
145
- hotkey?: string;
146
- htmlTag: string;
147
- label: string;
148
- icon: string;
149
- renderHtml: (text: string) => string;
150
- }> = {
151
- 'bold': {
152
- hotkey: 'mod+b',
153
- htmlTag: 'strong',
154
- label: 'Bold',
155
- icon: '𝐁',
156
- renderHtml: (text: string) => `<strong>${text}</strong>`
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
- 'italic': {
159
- hotkey: 'mod+i',
160
- htmlTag: 'em',
161
- label: 'Italic',
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
- 'underline': {
166
- hotkey: 'mod+u',
167
- htmlTag: 'u',
168
- label: 'Underline',
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
- 'strikethrough': {
173
- htmlTag: 's',
174
- label: 'Strikethrough',
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
- 'subscript': {
179
- htmlTag: 'sub',
180
- label: 'Subscript',
181
- icon: 'X₂',
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
- 'superscript': {
185
- htmlTag: 'sup',
186
- label: 'Superscript',
187
- icon: '',
188
- renderHtml: (text: string) => `<sup>${text}</sup>`
191
+ superscript: {
192
+ htmlTag: "sup",
193
+ label: "Superscript",
194
+ icon: "",
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<string, {
200
- htmlTag: string;
201
- label: string;
202
- icon: string;
203
- renderHtml: (text: string, alignStyle: string) => string;
204
- }> = {
205
- 'paragraph': {
206
- htmlTag: 'p',
207
- label: 'Paragraph',
208
- icon: '¶',
209
- renderHtml: (text: string, alignStyle: string) => `<p${alignStyle}>${text}</p>`
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
- 'no-tag': {
212
- htmlTag: 'no-tag',
213
- label: 'Plain Text',
214
- icon: 'T',
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
- 'heading-1': {
218
- htmlTag: 'h1',
219
- label: 'Heading 1',
220
- icon: 'H1',
221
- renderHtml: (text: string, alignStyle: string) => `<h1${alignStyle}>${text}</h1>`
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
- 'heading-2': {
224
- htmlTag: 'h2',
225
- label: 'Heading 2',
226
- icon: 'H2',
227
- renderHtml: (text: string, alignStyle: string) => `<h2${alignStyle}>${text}</h2>`
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
- 'heading-3': {
230
- htmlTag: 'h3',
231
- label: 'Heading 3',
232
- icon: 'H3',
233
- renderHtml: (text: string, alignStyle: string) => `<h3${alignStyle}>${text}</h3>`
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
- 'heading-4': {
236
- htmlTag: 'h4',
237
- label: 'Heading 4',
238
- icon: 'H4',
239
- renderHtml: (text: string, alignStyle: string) => `<h4${alignStyle}>${text}</h4>`
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
- 'heading-5': {
242
- htmlTag: 'h5',
243
- label: 'Heading 5',
244
- icon: 'H5',
245
- renderHtml: (text: string, alignStyle: string) => `<h5${alignStyle}>${text}</h5>`
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<string, {
257
- label: string;
258
- icon: string;
259
- value: Alignment;
260
- }> = {
261
- 'left': { label: 'Align Left', icon: '←', value: 'left' },
262
- 'center': { label: 'Align Center', icon: '↔', value: 'center' },
263
- 'right': { label: 'Align Right', icon: '→', value: 'right' },
264
- 'justify': { label: 'Justify', icon: '≡', value: 'justify' }
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("reviews");
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
- <span
355
- className="cursor-pointer opacity-0 transition-opacity group-hover:opacity-100"
356
- onClick={() => {
357
- editContext.select([
358
- component.parentPlaceholder?.parentComponent.id || "",
359
- ]);
360
- }}
361
- >
362
- <ArrowUpFromDot height={14} width={14} />
363
- </span>
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-20 shadow-xl"
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 renderUrl = new URL(
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
- functionName?: string;
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
  /**
@@ -116,6 +116,8 @@ export async function executePrompt(
116
116
  ...options,
117
117
  };
118
118
 
119
+ console.log("ExecutePrompt: requestBody", requestBody);
120
+
119
121
  finalRequestOptions = {
120
122
  method: "POST",
121
123
  body: JSON.stringify(requestBody),
@@ -1,10 +1,11 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
2
  import { useEditContext } from "../editor/client/editContext";
3
- import { getWizards } from "./service";
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<any>(null);
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 availableWizards = await getWizards(
122
+ const foundWizard = await getWizard(
123
+ wizardId,
121
124
  editContext.contentEditorItem.descriptor,
122
125
  );
123
- const foundWizard = availableWizards.find((w) => w.id === wizardId);
124
- if (foundWizard) {
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 wizards:", error);
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
  }: {