Browse Source

fix: width and height preservation

pull/9766/head
DarkPhoenix2704 2 weeks ago
parent
commit
eb314d6bcd
  1. 30
      packages/nc-gui/components/cell/TextArea.vue

30
packages/nc-gui/components/cell/TextArea.vue

@ -209,6 +209,36 @@ watch(inputWrapperRef, () => {
const handleClose = () => { const handleClose = () => {
isVisible.value = false isVisible.value = false
} }
const STORAGE_KEY = 'nc-long-text-expanded-modal-size'
const { width: widthTextArea, height: heightTextArea } = useElementSize(inputRef)
watch([widthTextArea, heightTextArea], () => {
if (isVisible.value) {
const size = {
width: widthTextArea.value,
height: heightTextArea.value,
}
localStorage.setItem(STORAGE_KEY, JSON.stringify(size))
}
})
watch([isVisible, inputRef], (value) => {
if (value) {
const size = localStorage.getItem(STORAGE_KEY)
let elem = document.querySelector('.nc-text-area-expanded') as HTMLElement
if (isRichMode.value) {
elem = document.querySelector('.nc-long-text-expanded-modal .nc-textarea-rich-editor .tiptap') as HTMLElement
}
if (size && elem) {
elem.style.width = `${JSON.parse(size).width}px`
elem.style.height = `${JSON.parse(size).height}px`
}
}
})
</script> </script>
<template> <template>

Loading…
Cancel
Save