@pretextbook/web-editor 0.5.3 → 0.6.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 +8 -3
- package/dist/components/Editors.d.ts +19 -4
- package/dist/index.es.js +6113 -2839
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/sectionUtils.d.ts +20 -0
- package/dist/store/editorStore.d.ts +1 -0
- package/package.json +2 -2
package/dist/sectionUtils.d.ts
CHANGED
|
@@ -187,11 +187,30 @@ export declare function parseDivisionRefs(content: string): string[];
|
|
|
187
187
|
* Like {@link parseDivisionRefs} but also returns the division type inferred
|
|
188
188
|
* from the tag name (e.g. `<plus:chapter ref="x"/>` → `{ type: "chapter", xmlId: "x" }`).
|
|
189
189
|
* Used to auto-create Division records when new refs appear in edited content.
|
|
190
|
+
*
|
|
191
|
+
* Only tag names in {@link DIVISION_REF_TAGS} are considered — asset
|
|
192
|
+
* placeholders (`plus:image`, `plus:doenet`, ...) are not divisions and are
|
|
193
|
+
* skipped. The generic `<plus:division ref="x"/>` alias falls back to type
|
|
194
|
+
* `"section"`, matching {@link tagToType}'s default for unrecognised tags.
|
|
190
195
|
*/
|
|
191
196
|
export declare function parseDivisionRefsWithTypes(content: string): {
|
|
192
197
|
xmlId: string;
|
|
193
198
|
type: DivisionType;
|
|
194
199
|
}[];
|
|
200
|
+
/** A `<plus:image ref="..."/>` / `<plus:doenet ref="..."/>` asset placeholder. */
|
|
201
|
+
export interface AssetRef {
|
|
202
|
+
kind: "image" | "doenet";
|
|
203
|
+
ref: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Parse every `<plus:image ref="..."/>` / `<plus:doenet ref="..."/>` asset
|
|
207
|
+
* placeholder out of `content`, in document order, without de-duplicating.
|
|
208
|
+
*
|
|
209
|
+
* Asset placeholders share the `<plus:* ref="..."/>` shape used by division
|
|
210
|
+
* refs (see {@link DIVISION_REF_TAGS}) but are deliberately parsed by a
|
|
211
|
+
* separate, disjoint tag set so the two kinds of include are never conflated.
|
|
212
|
+
*/
|
|
213
|
+
export declare function parseAssetRefs(content: string): AssetRef[];
|
|
195
214
|
/**
|
|
196
215
|
* Create a minimal Division record for a given `xmlId` and `type`.
|
|
197
216
|
* Used when the user types a new `<plus:TYPE ref="id"/>` placeholder into a
|
|
@@ -347,3 +366,4 @@ export declare function assembleFullProjectSource(divisions: Division[], rootXml
|
|
|
347
366
|
* document shape.
|
|
348
367
|
*/
|
|
349
368
|
export declare function wrapDivisionForPreview(divisionType: DivisionType, divisionXml: string, docinfo: string, wrapperTitle: string): string;
|
|
369
|
+
export declare function normalizeDivisionsOnLoad(divisions: Division[], rootDivisionId: string | undefined, projectType: "article" | "book" | undefined): Division[];
|
|
@@ -30,6 +30,7 @@ import type { Asset, FeedbackSubmission, SourceFormat } from "../types/editor";
|
|
|
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;
|
|
33
34
|
title?: string;
|
|
34
35
|
type?: DivisionType;
|
|
35
36
|
xmlId?: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pretextbook/web-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A web-based editor for PreTeXt documents, with simple preview functionality",
|
|
6
6
|
"keywords": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@pretextbook/completions": "^0.0.3",
|
|
53
53
|
"@pretextbook/format": "^0.2.0",
|
|
54
54
|
"@pretextbook/latex-pretext": "^0.0.10",
|
|
55
|
-
"@pretextbook/remark-pretext": "^0.0.
|
|
55
|
+
"@pretextbook/remark-pretext": "^0.0.6",
|
|
56
56
|
"@pretextbook/visual-editor": "^0.0.6",
|
|
57
57
|
"@tailwindcss/vite": "^4.1.18",
|
|
58
58
|
"react-resizable-panels": "^4.11.2",
|