From a8e0387b691584b191026bdf1aba97ed6e961a0f Mon Sep 17 00:00:00 2001 From: StudioCMS Date: Sun, 22 Dec 2024 09:58:21 +0000 Subject: [PATCH] [ci] lint --- .../src/components/Tabs/Tabs.astro | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/packages/studiocms_ui/src/components/Tabs/Tabs.astro b/packages/studiocms_ui/src/components/Tabs/Tabs.astro index 5c22c61..96d32f2 100644 --- a/packages/studiocms_ui/src/components/Tabs/Tabs.astro +++ b/packages/studiocms_ui/src/components/Tabs/Tabs.astro @@ -77,20 +77,23 @@ const extractTabInfoWithRegex = (input: string) => { const markTabAsActive = (tabId: string, html: string): string => { if (!tabId) return html; - const updatedHtml = html.replace(/]*data-tab-id="([^"]*)"[^>]*>/g, (match, tabIdValue) => { - // Check if the tabId matches - if (tabIdValue === tabId) { - // Check if the element already has a class attribute - if (match.includes('class="')) { - // If class attribute exists, add 'active' to the class attribute - return match.replace(/(class="[^"]*)"/, '$1 active"'); - } - - // If class attribute does not exist, add it - return match.replace(/(]*data-tab-id="[^"]*")/, '$1 class="active"'); - } - return match; // Return original if the tabId does not match - }); + const updatedHtml = html.replace( + /]*data-tab-id="([^"]*)"[^>]*>/g, + (match, tabIdValue) => { + // Check if the tabId matches + if (tabIdValue === tabId) { + // Check if the element already has a class attribute + if (match.includes('class="')) { + // If class attribute exists, add 'active' to the class attribute + return match.replace(/(class="[^"]*)"/, '$1 active"'); + } + + // If class attribute does not exist, add it + return match.replace(/(]*data-tab-id="[^"]*")/, '$1 class="active"'); + } + return match; // Return original if the tabId does not match + } + ); return updatedHtml; };