From e3a3637748b8dbc19915097387b7037ae0681594 Mon Sep 17 00:00:00 2001 From: Jayesh Deorukhkar Date: Wed, 8 Nov 2023 16:10:18 +0530 Subject: [PATCH] fix: remove float from imaage tag for image type assets --- src/toRedactor.tsx | 6 +++--- test/testingData.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/toRedactor.tsx b/src/toRedactor.tsx index d5f2d6e..829a7d8 100644 --- a/src/toRedactor.tsx +++ b/src/toRedactor.tsx @@ -456,9 +456,9 @@ export const toRedactor = (jsonValue: any,options?:IJsonToHtmlOptions) : string styleObj["width"] = "auto"; } delete styleObj["float"]; - (attrsJson["style"] && typeof attrsJson["style"] === 'string') - ? (attrsJson["style"] += getStyleStringFromObject(styleObj)) - : (attrsJson["style"] = getStyleStringFromObject(styleObj)); + // (attrsJson["style"] && typeof attrsJson["style"] === 'string') + // ? (attrsJson["style"] += getStyleStringFromObject(styleObj)) : + (attrsJson["style"] = getStyleStringFromObject(styleObj)); } delete attrsJson['display-type'] } diff --git a/test/testingData.ts b/test/testingData.ts index 7f5b96a..ba4bf23 100644 --- a/test/testingData.ts +++ b/test/testingData.ts @@ -178,7 +178,7 @@ export const imageAssetData = { ], }, ]), - expectedHtml: `
`, + expectedHtml: `
`, }, anchor: { value: getDoc([ @@ -394,7 +394,7 @@ export const imageAssetData = { ], }, ]), - expectedHtml: `
I am BATMAN
BATMAN
I am BATMAN
BATMAN
I am BATMAN
BATMAN
I am BATMAN
BATMAN
`, + expectedHtml: `
I am BATMAN
BATMAN
I am BATMAN
BATMAN
I am BATMAN
BATMAN
I am BATMAN
BATMAN
`, }, "inline-base": { value: getDoc([ @@ -647,7 +647,7 @@ export const imageAssetData = { ], }, ]), - expectedHtml: `
I am batman
I am batman
`, + expectedHtml: `
I am batman
I am batman
`, }, "inline-anchor": { value: getDoc([ @@ -873,7 +873,7 @@ export const imageAssetData = { ], }, ]), - expectedHtml: `
I am BATMAN
BATMAN
I am batman
I am BATMAN
BATMAN
I am batman
`, + expectedHtml: `
I am BATMAN
BATMAN
I am batman
I am BATMAN
BATMAN
I am batman
`, }, };