@uniweb/semantic-parser 1.1.19 → 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.19",
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",
@@ -154,6 +154,20 @@ function createSequenceElement(node, options = {}) {
154
154
  attrs,
155
155
  };
156
156
 
157
+ case "inset_block": {
158
+ // The block form of an inset: a component reference that carries
159
+ // real block content. Its children are processed like a
160
+ // blockquote's — the default branch would flatten them to a text
161
+ // string, which loses the author's prose entirely.
162
+ const { component, ...params } = attrs || {};
163
+ return {
164
+ type: "inset_block",
165
+ component,
166
+ params,
167
+ children: processSequence({ content }),
168
+ };
169
+ }
170
+
157
171
  case "dataBlock":
158
172
  // Pre-parsed structured data from content-reader
159
173
  return {
@@ -641,10 +655,27 @@ function parseUniwebIcon(itemAttrs) {
641
655
  return icon;
642
656
  }
643
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.
644
671
  function parseIconBlock(itemAttrs) {
645
- let { svg } = itemAttrs;
672
+ const { svg, theme } = itemAttrs || {};
646
673
 
647
- return svg;
674
+ const icon = {};
675
+ if (svg) icon.svg = svg;
676
+ if (theme) icon.theme = theme;
677
+
678
+ return icon;
648
679
  }
649
680
 
650
681
  function parseImgBlock(itemAttrs) {