@uniweb/semantic-parser 1.1.20 → 1.1.21

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.20",
3
+ "version": "1.1.21",
4
4
  "description": "Semantic parser for ProseMirror/TipTap content structures",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -655,10 +655,27 @@ function parseUniwebIcon(itemAttrs) {
655
655
  return icon;
656
656
  }
657
657
 
658
+ // The editor's `Icon` node carries an inline SVG blob plus a theme. Return an
659
+ // ATTRS OBJECT, like every other parser in this file — not the bare `svg`
660
+ // string it used to return.
661
+ //
662
+ // The string form was a live bug, not just an inconsistency: kit renders a
663
+ // sequence icon with `<Icon {...element.attrs} />` (styled/Prose/index.jsx),
664
+ // and spreading a string yields indexed character props — `{0:'<', 1:'s', …}`
665
+ // — so the icon rendered as nothing and React saw a wall of unknown props. It
666
+ // failed silently because `attrs.svg` on a string is `undefined`, never an
667
+ // error.
668
+ //
669
+ // Keys are omitted when absent so a consumer can distinguish "not provided"
670
+ // from "empty", matching parseUniwebIcon's shape above.
658
671
  function parseIconBlock(itemAttrs) {
659
- let { svg } = itemAttrs;
672
+ const { svg, theme } = itemAttrs || {};
660
673
 
661
- return svg;
674
+ const icon = {};
675
+ if (svg) icon.svg = svg;
676
+ if (theme) icon.theme = theme;
677
+
678
+ return icon;
662
679
  }
663
680
 
664
681
  function parseImgBlock(itemAttrs) {