fix: performance issues due to mouse on header detection

This commit is contained in:
Andrew Bastin
2023-11-08 18:47:40 +05:30
parent 2bd925d441
commit 9d1d369f37
4 changed files with 12 additions and 25 deletions

View File

@@ -92,7 +92,6 @@ declare module '@vue/runtime-core' {
HoppButtonPrimary: typeof import('@hoppscotch/ui')['HoppButtonPrimary']
HoppButtonSecondary: typeof import('@hoppscotch/ui')['HoppButtonSecondary']
HoppSmartAnchor: typeof import('@hoppscotch/ui')['HoppSmartAnchor']
HoppSmartAutoComplete: typeof import('@hoppscotch/ui')['HoppSmartAutoComplete']
HoppSmartCheckbox: typeof import('@hoppscotch/ui')['HoppSmartCheckbox']
HoppSmartConfirmModal: typeof import('@hoppscotch/ui')['HoppSmartConfirmModal']
HoppSmartExpand: typeof import('@hoppscotch/ui')['HoppSmartExpand']

View File

@@ -1,7 +1,9 @@
<template>
<div>
<header
ref="headerRef"
class="flex items-center justify-between flex-1 flex-shrink-0 px-2 py-2 space-x-2 overflow-x-auto overflow-y-hidden"
@mousedown.prevent="platform.ui?.appHeader?.onHeaderAreaClick?.()"
>
<div
class="inline-flex items-center justify-start flex-1 space-x-2"

View File

@@ -20,6 +20,11 @@ export type UIPlatformDef = {
appHeader?: {
paddingTop?: Ref<string>
paddingLeft?: Ref<string>
/**
* A function which is called when the header area of the app receives a click event
*/
onHeaderAreaClick?: () => void
}
onCodemirrorInstanceMount?: (element: HTMLElement) => void