@pretextbook/web-editor 0.14.0 → 0.15.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.
- package/dist/components/AssetManagerModal.d.ts +10 -12
- package/dist/components/CodeEditor.d.ts +1 -0
- package/dist/components/CodeEditorMenu.d.ts +1 -0
- package/dist/components/Editors.d.ts +18 -21
- package/dist/components/TableOfContents.d.ts +3 -1
- package/dist/components/toc/ArticleToc.d.ts +2 -1
- package/dist/index.es.js +482 -593
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/sectionUtils.d.ts +8 -8
- package/dist/store/editorStore.d.ts +1 -15
- package/dist/types/editor.d.ts +10 -3
- package/dist/types/sections.d.ts +9 -2
- package/package.json +1 -1
package/dist/sectionUtils.d.ts
CHANGED
|
@@ -140,18 +140,18 @@ export declare function updateLatexDivisionMetadata(division: Division, changes:
|
|
|
140
140
|
* Convert a LaTeX division's source to PreTeXt by passing the visible LaTeX
|
|
141
141
|
* straight to `@pretextbook/latex-pretext` and using its output as-is.
|
|
142
142
|
*
|
|
143
|
-
* A
|
|
144
|
-
* converts to its own
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
143
|
+
* A division's header (`\section{…}\label{…}`, `\worksheet{…}`, … — and, for a
|
|
144
|
+
* root division, `\article{…}`/`\book{…}`/`\slideshow{…}`) converts to its own
|
|
145
|
+
* complete `<type xml:id="…"><title>…>` element, so the conversion is used
|
|
146
|
+
* exactly as produced with no extra wrapper added here — doing so would nest a
|
|
147
|
+
* second `<article>`/`<book>`/`<slideshow>` around the one the converter
|
|
148
|
+
* already emitted from the header. If a header doesn't convert correctly,
|
|
149
|
+
* that surfaces here to be fixed in the converter rather than worked around.
|
|
150
150
|
*
|
|
151
151
|
* Returns `null` when the conversion fails, so callers can disable the convert
|
|
152
152
|
* action / fall back.
|
|
153
153
|
*/
|
|
154
|
-
export declare function latexDivisionToTaggedPretext(division: Pick<Division, "source"
|
|
154
|
+
export declare function latexDivisionToTaggedPretext(division: Pick<Division, "source">): string | null;
|
|
155
155
|
/** Create a new blank LaTeX section as a `Division`. */
|
|
156
156
|
export declare function createNewLatexSection(title?: string): DocumentSection;
|
|
157
157
|
/** Create a blank LaTeX introduction. */
|
|
@@ -30,7 +30,6 @@ import type { Asset, AssetKind, FeedbackSubmission, SourceFormat } from "../type
|
|
|
30
30
|
import type { Division, DivisionType } from "../types/sections";
|
|
31
31
|
import type { EditDraft } from "../components/toc/types";
|
|
32
32
|
export type DivisionChanges = {
|
|
33
|
-
id?: string;
|
|
34
33
|
title?: string;
|
|
35
34
|
type?: DivisionType;
|
|
36
35
|
xmlId?: string | null;
|
|
@@ -93,12 +92,6 @@ export interface EditorStoreState {
|
|
|
93
92
|
* it's added, without waiting for the host to echo it back.
|
|
94
93
|
*/
|
|
95
94
|
projectAssets: Asset[] | undefined;
|
|
96
|
-
/**
|
|
97
|
-
* The user's cross-project asset library. Unlike `projectAssets` this stays a
|
|
98
|
-
* host-owned, fetch-on-demand cache (loaded via `onLoadLibraryAssets`), so it
|
|
99
|
-
* is still mirrored from props every render via `syncState`.
|
|
100
|
-
*/
|
|
101
|
-
libraryAssets: Asset[] | undefined;
|
|
102
95
|
title: string;
|
|
103
96
|
docinfo: string;
|
|
104
97
|
commonDocinfo: string;
|
|
@@ -196,13 +189,6 @@ export interface EditorStoreState {
|
|
|
196
189
|
removeAssetRefFromDocument: (kind: AssetKind, ref: string) => void;
|
|
197
190
|
/** Duplicate a project asset under a fresh ref. Resolves when the host settles. */
|
|
198
191
|
duplicateAsset: (asset: Asset) => Promise<void>;
|
|
199
|
-
/**
|
|
200
|
-
* Replace the whole project-asset pool — e.g. after `onLoadAssets` resolves
|
|
201
|
-
* with the server's fresh list. The server is authoritative at that point,
|
|
202
|
-
* so this overwrites the pool wholesale (matching how the divisions pool is
|
|
203
|
-
* reset on an external update).
|
|
204
|
-
*/
|
|
205
|
-
setProjectAssets: (assets: Asset[]) => void;
|
|
206
192
|
/**
|
|
207
193
|
* Optimistically add an asset to the pool (no-op if one with the same
|
|
208
194
|
* kind+ref already exists). Used when an asset is uploaded, created, added
|
|
@@ -227,7 +213,7 @@ export interface EditorStoreState {
|
|
|
227
213
|
feedbackSubmit: (feedback: FeedbackSubmission) => void;
|
|
228
214
|
}
|
|
229
215
|
/** The subset of EditorStoreState that Editors.tsx syncs on each render. */
|
|
230
|
-
export type EditorSyncableState = Pick<EditorStoreState, "source" | "sourceFormat" | "
|
|
216
|
+
export type EditorSyncableState = Pick<EditorStoreState, "source" | "sourceFormat" | "title" | "docinfo" | "commonDocinfo" | "useCommonDocinfo" | "projectType" | "projectUrl" | "divisions" | "rootDivisionId" | "activeDivisionId" | "canConvertToPretext" | "activeEditorSource" | "hasFeedback" | "hasAssetDuplicate">;
|
|
231
217
|
export interface EditorStoreInit {
|
|
232
218
|
source: string;
|
|
233
219
|
sourceFormat: SourceFormat;
|
package/dist/types/editor.d.ts
CHANGED
|
@@ -2,10 +2,17 @@
|
|
|
2
2
|
export type SourceFormat = "pretext" | "latex" | "markdown";
|
|
3
3
|
/** The kind of a project asset — determines the inserted PreTeXt tag. */
|
|
4
4
|
export type AssetKind = "image" | "doenet";
|
|
5
|
-
/** An asset
|
|
5
|
+
/** An asset owned by a single project. */
|
|
6
6
|
export interface Asset {
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Stable server-assigned identifier (hidden from users). Assets are
|
|
9
|
+
* persisted through the project's nested `assets_attributes`, so a
|
|
10
|
+
* freshly-created asset has **no** `id` until the project is saved and the
|
|
11
|
+
* server mints one — the *absence* of an `id` is the signal that an asset is
|
|
12
|
+
* new. The editor keys asset identity on `kind` + `ref` (never `id`), so an
|
|
13
|
+
* id-less asset is fully usable the instant it's added.
|
|
14
|
+
*/
|
|
15
|
+
id?: string;
|
|
9
16
|
/** Human-readable display title shown in the library UI. */
|
|
10
17
|
title: string;
|
|
11
18
|
/** Short reference used when authoring references, e.g. `"euler-painting"`.
|
package/dist/types/sections.d.ts
CHANGED
|
@@ -29,8 +29,15 @@ export type DivisionType = "book" | "article" | "slideshow" | "part" | "chapter"
|
|
|
29
29
|
* the editor.
|
|
30
30
|
*/
|
|
31
31
|
export interface Division {
|
|
32
|
-
/**
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Stable server-assigned identifier. Divisions are persisted through the
|
|
34
|
+
* project's nested `divisions_attributes`, so a freshly-created division has
|
|
35
|
+
* **no** `id` until the project is saved and the server mints one — the
|
|
36
|
+
* *absence* of an `id` is the signal that a division is new. The editor keys
|
|
37
|
+
* division identity on `xmlId` (never `id`), so an id-less division is fully
|
|
38
|
+
* usable the instant it's added.
|
|
39
|
+
*/
|
|
40
|
+
id?: string;
|
|
34
41
|
/**
|
|
35
42
|
* The `xml:id` attribute value for this division. Used as the `ref`
|
|
36
43
|
* value in `<plus:division ref="..."/>` placeholders in parent divisions.
|