Skip to content

Commit 4219389

Browse files
committed
fix: RT-286 remove redundant _self for asset link
1 parent dc66fc8 commit 4219389

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/fromRedactor.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,11 @@ export const fromRedactor = (el: any, options?:IHtmlToJsonOptions) : IAnyObject
437437
}
438438
}
439439
elementAttrs.attrs["redactor-attributes"] = redactor
440-
return jsx('element', { attrs: { ...elementAttrs?.attrs, type, "asset-caption": caption, "link": link, "asset-alt": alt, target, position, "asset-link": fileLink, "asset-uid": uid, "display-type": displayType, "asset-name": fileName, "asset-type": contentType, "content-type-uid": contentTypeUid }, type: "reference", uid: generateId() }, children)
440+
const assetAttrs = { ...elementAttrs?.attrs, type, "asset-caption": caption, "link": link, "asset-alt": alt, target, position, "asset-link": fileLink, "asset-uid": uid, "display-type": displayType, "asset-name": fileName, "asset-type": contentType, "content-type-uid": contentTypeUid }
441+
if(assetAttrs.target === "_self"){
442+
delete assetAttrs.target
443+
}
444+
return jsx('element', { attrs: assetAttrs, type: "reference", uid: generateId() }, children)
441445
}
442446
}
443447
if (nodeName === 'FIGCAPTION') {

0 commit comments

Comments
 (0)