@pretextbook/web-editor 0.12.0 → 0.13.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/index.es.js +348 -298
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/sectionUtils.d.ts +7 -3
- package/dist/types/editor.d.ts +15 -14
- package/package.json +1 -1
package/dist/sectionUtils.d.ts
CHANGED
|
@@ -306,8 +306,12 @@ export declare function canEmbedDivisionRefs(sourceFormat: SourceFormat): boolea
|
|
|
306
306
|
*
|
|
307
307
|
* Only direct children are returned — the function does not recurse.
|
|
308
308
|
* Call it for each division in the pool to build the full tree.
|
|
309
|
+
*
|
|
310
|
+
* `sourceFormat` is the parent division's format: only that format's include
|
|
311
|
+
* syntax is scanned, and its verbatim spans are blanked first, so example
|
|
312
|
+
* placeholders in code samples don't become phantom children.
|
|
309
313
|
*/
|
|
310
|
-
export declare function parseDivisionRefs(content: string): string[];
|
|
314
|
+
export declare function parseDivisionRefs(content: string, sourceFormat: SourceFormat): string[];
|
|
311
315
|
/**
|
|
312
316
|
* Like {@link parseDivisionRefs} but also returns the division type inferred
|
|
313
317
|
* from the tag name (e.g. `<plus:chapter ref="x"/>` → `{ type: "chapter", xmlId: "x" }`).
|
|
@@ -318,7 +322,7 @@ export declare function parseDivisionRefs(content: string): string[];
|
|
|
318
322
|
* skipped. The generic `<plus:division ref="x"/>` alias falls back to type
|
|
319
323
|
* `"section"`, matching {@link tagToType}'s default for unrecognised tags.
|
|
320
324
|
*/
|
|
321
|
-
export declare function parseDivisionRefsWithTypes(content: string): {
|
|
325
|
+
export declare function parseDivisionRefsWithTypes(content: string, sourceFormat: SourceFormat): {
|
|
322
326
|
xmlId: string;
|
|
323
327
|
type: DivisionType;
|
|
324
328
|
}[];
|
|
@@ -340,7 +344,7 @@ export interface AssetRef {
|
|
|
340
344
|
* disjoint tag set (`image`/`doenet`) so the two kinds of include are never
|
|
341
345
|
* conflated.
|
|
342
346
|
*/
|
|
343
|
-
export declare function parseAssetRefs(content: string): AssetRef[];
|
|
347
|
+
export declare function parseAssetRefs(content: string, sourceFormat: SourceFormat): AssetRef[];
|
|
344
348
|
/**
|
|
345
349
|
* Rewrite every asset placeholder for `oldRef` in `content` to use `newRef`
|
|
346
350
|
* instead, leaving any other attributes (e.g. `width="50%"`) untouched. The
|
package/dist/types/editor.d.ts
CHANGED
|
@@ -26,28 +26,29 @@ export interface Asset {
|
|
|
26
26
|
/**
|
|
27
27
|
* Whether this asset is backed by an uploaded/fetched file rather than
|
|
28
28
|
* being defined purely by `source`. File-based image assets emit a
|
|
29
|
-
* `source` attribute on the generated `<image>` element
|
|
30
|
-
* {@link
|
|
31
|
-
*
|
|
29
|
+
* `source` attribute on the generated `<image>` element built from this
|
|
30
|
+
* asset's {@link ref} plus a file extension (e.g. `ref="euler-painting"`
|
|
31
|
+
* with a PNG upload emits `source="euler-painting.png"`); non-file image
|
|
32
|
+
* assets carry no `source` attribute and rely entirely on their authored
|
|
32
33
|
* `source` content.
|
|
33
34
|
*/
|
|
34
35
|
isFile?: boolean;
|
|
35
36
|
/**
|
|
36
|
-
* Publicly accessible URL used
|
|
37
|
-
* (`<img src={url}>`).
|
|
38
|
-
*
|
|
39
|
-
* `
|
|
37
|
+
* Publicly accessible URL used as the asset-manager thumbnail
|
|
38
|
+
* (`<img src={url}>`). Its filename extension (if any) is also used, as a
|
|
39
|
+
* fallback after {@link fileRef}, to determine the extension appended to
|
|
40
|
+
* `ref` for the generated `<image source="...">` attribute. The URL itself
|
|
41
|
+
* (e.g. a UUID-based storage key) is never written into the document.
|
|
40
42
|
*/
|
|
41
43
|
url?: string;
|
|
42
44
|
/**
|
|
43
|
-
* The
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
45
|
+
* The server-assigned storage filename for a file-backed asset (e.g. a
|
|
46
|
+
* UUID-based key). Its extension, if present, is used to build the
|
|
47
|
+
* `source` attribute of the generated `<image>` element as
|
|
48
|
+
* `"{ref}.{extension}"` — the rest of this value (e.g. the UUID itself)
|
|
49
|
+
* is never written into the document.
|
|
48
50
|
*
|
|
49
|
-
* Only meaningful when {@link isFile} is true.
|
|
50
|
-
* fall back to {@link url} so existing hosts keep working unchanged.
|
|
51
|
+
* Only meaningful when {@link isFile} is true.
|
|
51
52
|
*/
|
|
52
53
|
fileRef?: string;
|
|
53
54
|
/** Mime type for the asset, if applicable. Used for hints only. */
|