Compare commits

..

No commits in common. "d20d1f3bed2ccbfbf9327ba9522a72675f05481b" and "e39e78eda30ad3e82c4c1d5f1d75a95583ef37fe" have entirely different histories.

3 changed files with 6 additions and 46 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="dropdown-menu" ref="dropdownMenuRef">
<div class="dropdown-menu">
<n-virtual-list
ref="virtualListRef"
style="max-height: 240px"
@ -20,7 +20,7 @@
</template>
<script setup>
import { ref, watch, defineProps, defineExpose, onMounted, onUnmounted } from 'vue'
import { ref, watch, defineProps, defineExpose } from 'vue'
const props = defineProps({
items: {
@ -35,40 +35,6 @@ const props = defineProps({
const selectedIndex = ref(0)
const virtualListRef = ref(null)
const dropdownMenuRef = ref(null)
let observer = null
let isViewport = ref(true)
const handleIntersection = (entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
isViewport.value = true
//
} else {
isViewport.value = false
//
}
})
}
onMounted(() => {
observer = new IntersectionObserver(handleIntersection, {
root: null, // null
rootMargin: '0px',
threshold: 0.1 // 10%
})
if (dropdownMenuRef.value) {
observer.observe(dropdownMenuRef.value)
}
})
onUnmounted(() => {
if (observer && dropdownMenuRef.value) {
observer.unobserve(dropdownMenuRef.value)
observer.disconnect()
}
})
watch(
() => props.items,
@ -78,8 +44,7 @@ watch(
)
const onKeyDown = ({ event }) => {
console.log('event', event)
if(!isViewport.value) return false
console.log('event',event)
if (event.key === 'ArrowUp') {
upHandler()
return true
@ -135,7 +100,6 @@ defineExpose({
overflow: auto;
padding: 0.4rem;
position: relative;
max-height: 200px;
width: 200px;
button {

View File

@ -61,9 +61,6 @@ const props = defineProps({
type: Boolean,
default: false
},
uid:{
type: Number
},
members: {
default: () => []
}
@ -291,8 +288,7 @@ const editor = useEditor({
if (text) {
event.preventDefault()
const { state, dispatch } = view
// dispatch(state.tr.insertContent(text).replace(/\n/g, '<br>'))
editor.value.commands.insertContent(text.replace(/\r/g, '').replace(/\n/g, '<br>'))
dispatch(state.tr.insertText(text))
return true // Handled
}

View File

@ -75,7 +75,7 @@ const onSendMessage = (data = {}, callBack: any) => {
}
//
const onSendTextEvent = (value: any) => {
const onSendTextEvent = throttle((value: any) => {
let { data, callBack } = value
let message = {
@ -93,7 +93,7 @@ const onSendTextEvent = (value: any) => {
callBack(true)
})
}
}, 1000)
//
const onSendImageEvent = ({ data, callBack }) => {