fix: 空文本框检查错误(#169)

This commit is contained in:
pipipi-pikachu 2022-12-06 20:49:53 +08:00
parent 6cafd88270
commit 5ace85911b

View File

@ -63,6 +63,7 @@
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, PropType, ref, watch } from 'vue'
import { storeToRefs } from 'pinia'
import { debounce } from 'lodash'
import { useMainStore, useSlidesStore } from '@/store'
import { PPTTextElement } from '@/types/slides'
import { ContextmenuItem } from '@/components/Contextmenu/types'
@ -174,10 +175,10 @@ const updateContent = (content: string) => {
addHistorySnapshot()
}
const checkEmptyText = () => {
const checkEmptyText = debounce(function() {
const pureText = props.elementInfo.content.replaceAll(/<[^>]+>/g, '')
if (!pureText) slidesStore.deleteElement(props.elementInfo.id)
}
}, 300, { trailing: true })
const isHandleElement = computed(() => handleElementId.value === props.elementInfo.id)
watch(isHandleElement, () => {