@uniweb/semantic-parser 1.0.17 → 1.1.1

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.0.17",
3
+ "version": "1.1.1",
4
4
  "description": "Semantic parser for ProseMirror/TipTap content structures",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -343,6 +343,10 @@ function processGroupContent(elements) {
343
343
  }
344
344
  break;
345
345
 
346
+ case "child_block":
347
+ // Inline child block reference — preserved in sequence, not in flat fields
348
+ break;
349
+
346
350
  case "form":
347
351
  // Map FormBlock to data.form
348
352
  body.data.form = element.data || element.attrs;
@@ -153,6 +153,11 @@ function createSequenceElement(node, options = {}) {
153
153
  attrs,
154
154
  };
155
155
 
156
+ case "inline_child_placeholder":
157
+ return {
158
+ type: "child_block",
159
+ refId: attrs.refId,
160
+ };
156
161
  case "ImageBlock":
157
162
  return {
158
163
  type: "image",
@@ -295,17 +300,27 @@ function getTextContent(content, options = {}) {
295
300
  const spanMark = marks.find((mark) => mark.type === "span");
296
301
  const attrs = spanMark?.attrs || {};
297
302
  const attrParts = [];
303
+ const styleParts = [];
298
304
 
299
305
  if (attrs.class) attrParts.push(`class="${attrs.class}"`);
300
306
  if (attrs.id) attrParts.push(`id="${attrs.id}"`);
301
307
 
302
- // Add any other custom attributes (data-*, etc.)
303
308
  for (const [key, value] of Object.entries(attrs)) {
304
- if (key !== 'class' && key !== 'id') {
309
+ if (key === 'class' || key === 'id') continue;
310
+ // Convert color/bg to inline styles
311
+ if (key === 'color') {
312
+ styleParts.push(`color: ${value}`);
313
+ } else if (key === 'bg') {
314
+ styleParts.push(`background: ${value}`);
315
+ } else {
305
316
  attrParts.push(`${key}="${value}"`);
306
317
  }
307
318
  }
308
319
 
320
+ if (styleParts.length > 0) {
321
+ attrParts.push(`style="${styleParts.join('; ')}"`)
322
+ }
323
+
309
324
  const attrString = attrParts.length > 0 ? ` ${attrParts.join(' ')}` : '';
310
325
  styledText = `<span${attrString}>${styledText}</span>`;
311
326
  }