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') } }