@uniweb/semantic-parser 1.1.15 → 1.1.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/semantic-parser",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "Semantic parser for ProseMirror/TipTap content structures",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -480,6 +480,18 @@ function processInlineElements(children, body) {
480
480
  children.forEach((item) => {
481
481
  if (item.type === "icon") {
482
482
  body.icons.push(item.attrs);
483
+ } else if (item.type === "image") {
484
+ // Inline image inside a paragraph (e.g. `![alt](url)` next to
485
+ // text or icons that didn't qualify for block-level hoisting
486
+ // in content-reader). Mirror the top-level partition:
487
+ // icon-role goes to icons[], everything else to images[].
488
+ // Without this branch, inline images vanish from body.images
489
+ // and components reading `item.images?.[0]` see nothing.
490
+ if (item.attrs?.role === "icon") {
491
+ body.icons.push(item.attrs);
492
+ } else {
493
+ body.images.push(item.attrs);
494
+ }
483
495
  } else if (item.type === "link") {
484
496
  // Handle inline links extracted from paragraph text nodes
485
497
  body.links.push(item.attrs);
@@ -600,6 +600,7 @@ function parseImgBlock(itemAttrs) {
600
600
  direction,
601
601
  filter,
602
602
  alt = "",
603
+ src,
603
604
  url,
604
605
  href = "",
605
606
  target = "",
@@ -620,8 +621,15 @@ function parseImgBlock(itemAttrs) {
620
621
 
621
622
  caption = stripTags(caption);
622
623
 
624
+ // Standard ProseMirror `image` nodes use `src`; the custom
625
+ // `ImageBlock` node uses `url`. Honor either so callers don't have
626
+ // to pre-normalize. `identifier` (CDN-resolvable asset id) wins
627
+ // when present so an editor-deployed image with a stale `src`
628
+ // doesn't shadow the CDN copy.
623
629
  if (identifier) {
624
630
  url = makeAssetUrl(imgInfo);
631
+ } else if (!url && src) {
632
+ url = src;
625
633
  }
626
634
 
627
635
  return {