Browse Source

fix: review changes #7207

pull/7173/head
Ramesh Mane 9 months ago
parent
commit
fd7c100d9e
  1. 2
      packages/nc-gui/components/smartsheet/grid/Table.vue
  2. 6
      packages/nc-gui/composables/usePaste.ts

2
packages/nc-gui/components/smartsheet/grid/Table.vue

@ -169,7 +169,7 @@ const predictNextFormulas = async () => {
await _predictNextFormulas(meta) await _predictNextFormulas(meta)
} }
const { paste } = usePaste(true) const { paste } = usePaste()
// #Refs // #Refs

6
packages/nc-gui/composables/usePaste.ts

@ -1,12 +1,12 @@
import { useI18n, message } from '#imports' import { useI18n, message } from '#imports'
export const usePaste = (showDialogIfFailed = false) => { export const usePaste = () => {
const { t } = useI18n() const { t } = useI18n()
const paste = async (): Promise<boolean> => { const paste = async (): Promise<boolean> => {
try { try {
// Check if the Clipboard API is supported // Check if the Clipboard API is supported
if (!navigator.clipboard) return false if (!navigator.clipboard) throw new Error()
// Read text from the clipboard // Read text from the clipboard
const clipboardText = await navigator.clipboard.readText() const clipboardText = await navigator.clipboard.readText()
@ -27,8 +27,6 @@ export const usePaste = (showDialogIfFailed = false) => {
document.dispatchEvent(pasteEvent) document.dispatchEvent(pasteEvent)
return true return true
} catch (e) { } catch (e) {
if (!showDialogIfFailed) throw new Error(t('msg.error.pasteFromClipboardError'))
message.error(t('msg.error.pasteFromClipboardError')) message.error(t('msg.error.pasteFromClipboardError'))
return false return false

Loading…
Cancel
Save