@examplary/ui 1.53.0 → 1.54.0

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.
@@ -104,16 +104,20 @@ export var MinimalRichTextField = function (_a) {
104
104
  var editor = useEditor({
105
105
  onUpdate: function (_a) {
106
106
  var editor = _a.editor;
107
- var html = editor.getHTML();
108
- html = isEmpty(html) ? "" : html;
109
- setContent(html);
110
- onChange === null || onChange === void 0 ? void 0 : onChange(html);
107
+ if (onChange || !fragment) {
108
+ var html = editor.getHTML();
109
+ html = isEmpty(html) ? "" : html;
110
+ setContent(html);
111
+ onChange === null || onChange === void 0 ? void 0 : onChange(html);
112
+ }
111
113
  },
112
114
  onBlur: function (_a) {
113
115
  var editor = _a.editor;
114
- var html = editor.getHTML();
115
- html = isEmpty(html) ? "" : html;
116
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(html);
116
+ if (onBlur) {
117
+ var html = editor.getHTML();
118
+ html = isEmpty(html) ? "" : html;
119
+ onBlur(html);
120
+ }
117
121
  },
118
122
  autofocus: autoFocus,
119
123
  content: fragment ? undefined : content,
@@ -5,20 +5,26 @@ type Answer = {
5
5
  completed?: boolean;
6
6
  context?: any;
7
7
  };
8
- type SharedApiInstance = AxiosInstance & {
8
+ type AIMessage = {
9
+ role: "user" | "assistant" | "system";
10
+ content: string;
11
+ } & Record<string, any>;
12
+ type AIGenerateInput = {
13
+ /** The messages to send to the AI model */
14
+ messages: AIMessage[];
15
+ /** An optional JSON schema to validate the AI response against */
16
+ schema?: any;
17
+ };
18
+ type OrgApiInstance = AxiosInstance & {
19
+ uploadFile: (accept?: string) => Promise<any>;
20
+ uploadPickedFile: (file: File) => Promise<any>;
21
+ };
22
+ type PublicApiInstance = AxiosInstance & {
9
23
  uploadFile: (accept?: string) => Promise<any>;
10
24
  ai: {
11
- generate: (
12
- /** The messages to send to the AI model */
13
- messages: any[],
14
- /** An optional JSON schema to validate the AI response against */
15
- schema?: any) => Promise<any>;
25
+ generate: (input: AIGenerateInput) => Promise<any>;
16
26
  };
17
27
  };
18
- type OrgApiInstance = SharedApiInstance & {
19
- uploadPickedFile: (file: File) => Promise<any>;
20
- };
21
- type PublicApiInstance = SharedApiInstance;
22
28
  export type FrontendComponentEnvironment = "exam" | "practice-space";
23
29
  export type FrontendBaseComponentProps = {
24
30
  t: (key: string | string[], options?: any) => string;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@examplary/ui",
3
3
  "description": "UI components for the Examplary testing platform.",
4
4
  "packageManager": "yarn@4.5.3",
5
- "version": "1.53.0",
5
+ "version": "1.54.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "files": [