@pretextbook/web-editor 0.0.20 → 0.0.22

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.
@@ -0,0 +1,30 @@
1
+ /** The format of the source content being edited. */
2
+ export type SourceFormat = "pretext" | "latex";
3
+ /**
4
+ * Represents the full content state of the editor at any point in time.
5
+ * When `sourceFormat` is `"pretext"`, `pretextContent` mirrors `sourceContent`.
6
+ * When `sourceFormat` is `"latex"`, `pretextContent` holds the result of
7
+ * converting the LaTeX source, or `pretextError` holds a description of why
8
+ * conversion failed.
9
+ */
10
+ export interface EditorContentState {
11
+ /** The raw source string as typed/loaded by the user. */
12
+ sourceContent: string;
13
+ /** The format of `sourceContent`. */
14
+ sourceFormat: SourceFormat;
15
+ /**
16
+ * The PreTeXt XML derived from `sourceContent`.
17
+ * Present when conversion succeeded (or when the source is already PreTeXt).
18
+ */
19
+ pretextContent?: string;
20
+ /**
21
+ * Human-readable error message set when conversion from a non-PreTeXt
22
+ * format fails. When present, `pretextContent` will be undefined.
23
+ */
24
+ pretextError?: string;
25
+ }
26
+ /**
27
+ * The value passed to `onContentChange`. Identical to `EditorContentState`
28
+ * so consumers can inspect the full derived state on every change.
29
+ */
30
+ export type EditorContentChange = EditorContentState;