@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.
@@ -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
@@ -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 (from
30
- * {@link fileRef}, falling back to {@link url}); non-file image assets
31
- * carry no `source` attribute and rely entirely on their authored
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 **only** as the asset-manager thumbnail
37
- * (`<img src={url}>`). It is no longer the value written to the `<image>`
38
- * `source` attribute — use {@link fileRef} for that. It remains the
39
- * `source` fallback when `fileRef` is absent, for backwards compatibility.
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 exact string emitted as the `source` attribute of the generated
44
- * `<image>` element for a file-backed asset typically a bare external
45
- * filename like `"euler-painting.png"`. The PreTeXt build server treats
46
- * `<image source="X">` as an external-asset filename and prepends
47
- * `external/` itself, so this must be a bare filename, not a URL.
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. When absent, the emit sites
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. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretextbook/web-editor",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "private": false,
5
5
  "description": "A web-based editor for PreTeXt documents, with simple preview functionality",
6
6
  "keywords": [