@uniweb/semantic-parser 1.0.14 → 1.0.16
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
package/src/processors/groups.js
CHANGED
|
@@ -285,7 +285,12 @@ function processGroupContent(elements) {
|
|
|
285
285
|
break;
|
|
286
286
|
|
|
287
287
|
case "image":
|
|
288
|
-
|
|
288
|
+
// Check if this image is actually an icon (role="icon" from  syntax)
|
|
289
|
+
if (element.attrs?.role === "icon") {
|
|
290
|
+
body.icons.push(element.attrs);
|
|
291
|
+
} else {
|
|
292
|
+
body.imgs.push(preserveProps);
|
|
293
|
+
}
|
|
289
294
|
break;
|
|
290
295
|
|
|
291
296
|
case "video":
|
|
@@ -378,7 +378,7 @@ function processInlineElements(content) {
|
|
|
378
378
|
items.push({
|
|
379
379
|
type: "link",
|
|
380
380
|
attrs: {
|
|
381
|
-
|
|
381
|
+
...linkMark.attrs, // Preserve all link attributes (role, target, etc.)
|
|
382
382
|
label: item.text || "",
|
|
383
383
|
},
|
|
384
384
|
});
|
|
@@ -620,7 +620,7 @@ function isLink(item) {
|
|
|
620
620
|
}
|
|
621
621
|
|
|
622
622
|
return {
|
|
623
|
-
|
|
623
|
+
...mark?.attrs, // Preserve all link attributes (role, target, etc.)
|
|
624
624
|
label: contentItem?.text || "",
|
|
625
625
|
iconBefore,
|
|
626
626
|
iconAfter,
|
|
@@ -673,14 +673,14 @@ function isOnlyLinks(item) {
|
|
|
673
673
|
|
|
674
674
|
if (!allLinks) return false;
|
|
675
675
|
|
|
676
|
-
// Extract links
|
|
676
|
+
// Extract links with all their attributes
|
|
677
677
|
// Icons in this paragraph go to body.icons separately (no association)
|
|
678
678
|
return textContent.map((c) => {
|
|
679
679
|
const linkMark = c.marks.find((m) => m.type === "link");
|
|
680
680
|
return {
|
|
681
681
|
type: "link",
|
|
682
682
|
attrs: {
|
|
683
|
-
|
|
683
|
+
...linkMark?.attrs, // Preserve all link attributes (role, target, etc.)
|
|
684
684
|
label: c.text || "",
|
|
685
685
|
},
|
|
686
686
|
};
|