From 7456ffd6caf36141e85dddcd8a9d64a2d64d5ea7 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 1 Feb 2024 21:12:36 +0700 Subject: [PATCH 1/2] fix: remove zero width space when copying email --- .../HTMLRenderers/NextStepEmailRenderer.tsx | 9 ++++++++- src/libs/SelectionScraper/index.ts | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/NextStepEmailRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/NextStepEmailRenderer.tsx index b8292cad60a2..f172a56a03c3 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/NextStepEmailRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/NextStepEmailRenderer.tsx @@ -11,7 +11,14 @@ type NextStepEmailRendererProps = { function NextStepEmailRenderer({tnode}: NextStepEmailRendererProps) { const styles = useThemeStyles(); - return {tnode.data}; + return ( + + {tnode.data} + + ); } NextStepEmailRenderer.displayName = 'NextStepEmailRenderer'; diff --git a/src/libs/SelectionScraper/index.ts b/src/libs/SelectionScraper/index.ts index 955fe693c856..4a2166156594 100644 --- a/src/libs/SelectionScraper/index.ts +++ b/src/libs/SelectionScraper/index.ts @@ -112,6 +112,9 @@ const replaceNodes = (dom: Node, isChildOfEditorElement: boolean): Node => { // Encoding HTML chars '< >' in the text, because any HTML will be removed in stripHTML method. if (dom.type.toString() === 'text' && dom instanceof DataNode) { data = Str.htmlEncode(dom.data); + if (dom.parent instanceof Element && dom.parent?.attribs?.[tagAttribute] === 'email-with-break-opportunities') { + data = data.replaceAll('\u200b', ''); + } } else if (dom instanceof Element) { domName = dom.name; if (dom.attribs?.[tagAttribute]) { From 99a9c36c5388a19e262555e23419ea378201f606 Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 5 Feb 2024 23:18:14 +0700 Subject: [PATCH 2/2] use nativeID instead of testID --- .../HTMLEngineProvider/HTMLRenderers/NextStepEmailRenderer.tsx | 2 +- src/libs/SelectionScraper/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/NextStepEmailRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/NextStepEmailRenderer.tsx index f172a56a03c3..775bf75294eb 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/NextStepEmailRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/NextStepEmailRenderer.tsx @@ -13,7 +13,7 @@ function NextStepEmailRenderer({tnode}: NextStepEmailRendererProps) { return ( {tnode.data} diff --git a/src/libs/SelectionScraper/index.ts b/src/libs/SelectionScraper/index.ts index 4a2166156594..8d7f3e7055fc 100644 --- a/src/libs/SelectionScraper/index.ts +++ b/src/libs/SelectionScraper/index.ts @@ -112,7 +112,7 @@ const replaceNodes = (dom: Node, isChildOfEditorElement: boolean): Node => { // Encoding HTML chars '< >' in the text, because any HTML will be removed in stripHTML method. if (dom.type.toString() === 'text' && dom instanceof DataNode) { data = Str.htmlEncode(dom.data); - if (dom.parent instanceof Element && dom.parent?.attribs?.[tagAttribute] === 'email-with-break-opportunities') { + if (dom.parent instanceof Element && dom.parent?.attribs?.id === 'email-with-break-opportunities') { data = data.replaceAll('\u200b', ''); } } else if (dom instanceof Element) {