From f8c9198e4b4e4bc601306b8c73ef44ebf925c0d7 Mon Sep 17 00:00:00 2001 From: Jayesh Deorukhkar Date: Fri, 23 Aug 2024 10:58:59 +0530 Subject: [PATCH] fix: RT-286 remove redundant _self for asset link --- src/fromRedactor.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/fromRedactor.tsx b/src/fromRedactor.tsx index 555ce99..89cf5c6 100644 --- a/src/fromRedactor.tsx +++ b/src/fromRedactor.tsx @@ -437,7 +437,11 @@ export const fromRedactor = (el: any, options?:IHtmlToJsonOptions) : IAnyObject } } elementAttrs.attrs["redactor-attributes"] = redactor - 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) + 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 } + if(assetAttrs.target === "_self"){ + delete assetAttrs.target + } + return jsx('element', { attrs: assetAttrs, type: "reference", uid: generateId() }, children) } } if (nodeName === 'FIGCAPTION') {