From ea811402babc02708ef2997442e9c0c0f810a8e3 Mon Sep 17 00:00:00 2001 From: nikhil7174 Date: Thu, 10 Oct 2024 22:38:57 +0530 Subject: [PATCH] fixed issue of multiple times clicking retry button --- .../extension/content/content_scripts/rephraser.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/components/ping_ai_copilot/extension/content/content_scripts/rephraser.js b/components/ping_ai_copilot/extension/content/content_scripts/rephraser.js index 3bcd8e94a01f..852b5c030f55 100644 --- a/components/ping_ai_copilot/extension/content/content_scripts/rephraser.js +++ b/components/ping_ai_copilot/extension/content/content_scripts/rephraser.js @@ -106,7 +106,17 @@ const TextRephraser = (() => { const rightButton = createPillButton('rewrite', iconColor, 'Retry', () => { if (state.prevActiveElement) { - rephraseText(textBox); + if (state.pillContainer) { + state.pillContainer.remove(); + state.pillContainer = null; + } + + if (state.rephraseButton) { + state.rephraseButton.style.display = 'flex'; + updateButtonForFetching(textBox, img); + } + + rephraseText(textBox, img); } });