@uniweb/semantic-parser 1.0.17 → 1.1.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.
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.0",
4
4
  "description": "Semantic parser for ProseMirror/TipTap content structures",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -295,17 +295,27 @@ function getTextContent(content, options = {}) {
295
295
  const spanMark = marks.find((mark) => mark.type === "span");
296
296
  const attrs = spanMark?.attrs || {};
297
297
  const attrParts = [];
298
+ const styleParts = [];
298
299
 
299
300
  if (attrs.class) attrParts.push(`class="${attrs.class}"`);
300
301
  if (attrs.id) attrParts.push(`id="${attrs.id}"`);
301
302
 
302
- // Add any other custom attributes (data-*, etc.)
303
303
  for (const [key, value] of Object.entries(attrs)) {
304
- if (key !== 'class' && key !== 'id') {
304
+ if (key === 'class' || key === 'id') continue;
305
+ // Convert color/bg to inline styles
306
+ if (key === 'color') {
307
+ styleParts.push(`color: ${value}`);
308
+ } else if (key === 'bg') {
309
+ styleParts.push(`background: ${value}`);
310
+ } else {
305
311
  attrParts.push(`${key}="${value}"`);
306
312
  }
307
313
  }
308
314
 
315
+ if (styleParts.length > 0) {
316
+ attrParts.push(`style="${styleParts.join('; ')}"`)
317
+ }
318
+
309
319
  const attrString = attrParts.length > 0 ? ` ${attrParts.join(' ')}` : '';
310
320
  styledText = `<span${attrString}>${styledText}</span>`;
311
321
  }