Browse Source

fix: add telementry to cmd+j (#8981)

pull/8989/head
Anbarasu 5 months ago committed by GitHub
parent
commit
1f4af34f9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 16
      packages/nc-gui/plugins/tele.ts

16
packages/nc-gui/plugins/tele.ts

@ -107,6 +107,8 @@ function clickListener(e) {
e.nc_handled = true e.nc_handled = true
let target = e.target let target = e.target
const { $e } = useNuxtApp()
while (target && !target.classList.contains('DocSearch-Hit')) { while (target && !target.classList.contains('DocSearch-Hit')) {
target = target.parentElement target = target.parentElement
} }
@ -117,9 +119,14 @@ function clickListener(e) {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
url.searchParams.append('search', searchInput.value) url.searchParams.append('search', searchInput?.value)
url.searchParams.append('origin', location.hostname) url.searchParams.append('origin', location.hostname)
$e('a:cmdj:searchDocs', {
search: searchInput?.value,
url: url.toString(),
})
window.open(url.toString(), '_blank', 'noopener,noreferrer') window.open(url.toString(), '_blank', 'noopener,noreferrer')
} }
} }
@ -127,6 +134,8 @@ function clickListener(e) {
function keydownListener(e) { function keydownListener(e) {
if (e.nc_handled || e.which !== 13) return if (e.nc_handled || e.which !== 13) return
e.nc_handled = true e.nc_handled = true
const { $e } = useNuxtApp()
let target = e.target let target = e.target
while (target && !target.classList.contains('DocSearch-Input')) { while (target && !target.classList.contains('DocSearch-Input')) {
@ -144,6 +153,11 @@ function keydownListener(e) {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
$e('a:cmdj:searchDocs', {
search: target?.value,
url: url.toString(),
})
window.open(url.toString(), '_blank', 'noopener,noreferrer') window.open(url.toString(), '_blank', 'noopener,noreferrer')
} }
} }

Loading…
Cancel
Save