@meistrari/tela-build 1.59.0 → 1.59.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -56,6 +56,24 @@ onBeforeUnmount(() => {
|
|
|
56
56
|
unlockScroll()
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
+
function handleInteractOutside(event: CustomEvent) {
|
|
60
|
+
const originalEvent = (event.detail as { originalEvent?: Event } | undefined)?.originalEvent
|
|
61
|
+
|
|
62
|
+
if (originalEvent?.type !== 'pointerdown') {
|
|
63
|
+
event.preventDefault()
|
|
64
|
+
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const target = event.target
|
|
69
|
+
|
|
70
|
+
if (!(target instanceof Element))
|
|
71
|
+
return
|
|
72
|
+
|
|
73
|
+
if (!target.isConnected || target.closest('[data-reka-popper-content-wrapper], [data-dismissable-layer]'))
|
|
74
|
+
event.preventDefault()
|
|
75
|
+
}
|
|
76
|
+
|
|
59
77
|
function focusEditor(event: Event) {
|
|
60
78
|
event.preventDefault()
|
|
61
79
|
|
|
@@ -79,6 +97,7 @@ function focusEditor(event: Event) {
|
|
|
79
97
|
|
|
80
98
|
range.selectNodeContents(editor)
|
|
81
99
|
range.collapse(false)
|
|
100
|
+
|
|
82
101
|
selection.removeAllRanges()
|
|
83
102
|
selection.addRange(range)
|
|
84
103
|
})
|
|
@@ -104,6 +123,8 @@ function focusEditor(event: Event) {
|
|
|
104
123
|
'overflow-hidden rounded-12px! border-black/12! flex flex-col [box-shadow:-24px_-24px_249px_0_rgba(0,0,0,0.08),-12px_-8px_48px_0_rgba(0,0,0,0.03)]!',
|
|
105
124
|
)"
|
|
106
125
|
@open-auto-focus="focusEditor"
|
|
126
|
+
@interact-outside="handleInteractOutside"
|
|
127
|
+
@focus-outside.prevent
|
|
107
128
|
>
|
|
108
129
|
<slot />
|
|
109
130
|
</TelaPopoverContent>
|