From 1f4af34f9f4c607045e01782365ab417dffbccac Mon Sep 17 00:00:00 2001 From: Anbarasu Date: Thu, 11 Jul 2024 14:48:12 +0530 Subject: [PATCH] fix: add telementry to cmd+j (#8981) --- packages/nc-gui/plugins/tele.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/plugins/tele.ts b/packages/nc-gui/plugins/tele.ts index e3af210b7b..860f828627 100644 --- a/packages/nc-gui/plugins/tele.ts +++ b/packages/nc-gui/plugins/tele.ts @@ -107,6 +107,8 @@ function clickListener(e) { e.nc_handled = true let target = e.target + const { $e } = useNuxtApp() + while (target && !target.classList.contains('DocSearch-Hit')) { target = target.parentElement } @@ -117,9 +119,14 @@ function clickListener(e) { e.preventDefault() e.stopPropagation() - url.searchParams.append('search', searchInput.value) + url.searchParams.append('search', searchInput?.value) url.searchParams.append('origin', location.hostname) + $e('a:cmdj:searchDocs', { + search: searchInput?.value, + url: url.toString(), + }) + window.open(url.toString(), '_blank', 'noopener,noreferrer') } } @@ -127,6 +134,8 @@ function clickListener(e) { function keydownListener(e) { if (e.nc_handled || e.which !== 13) return e.nc_handled = true + const { $e } = useNuxtApp() + let target = e.target while (target && !target.classList.contains('DocSearch-Input')) { @@ -144,6 +153,11 @@ function keydownListener(e) { e.preventDefault() e.stopPropagation() + $e('a:cmdj:searchDocs', { + search: target?.value, + url: url.toString(), + }) + window.open(url.toString(), '_blank', 'noopener,noreferrer') } }