Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix copying results as markdown

Joshen Lim31971d5b9ead
diff --git a/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx b/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx
index 1fb97f2f787..e99aa95078a 100644
--- a/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx
+++ b/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx
@@ -7,7 +7,8 @@ import { compact } from 'lodash'
import { useMemo, useRef } from 'react'
import { CSVLink } from 'react-csv'
import { useSqlEditorStateSnapshot } from 'state/sql-editor'
-// import MarkdownTable from 'markdown-table'
+// @ts-ignore
+import MarkdownTable from 'markdown-table'
export type ResultsDropdownProps = {
id: string
@@ -46,18 +47,15 @@ const ResultsDropdown = ({ id }: ResultsDropdownProps) => {
return temp
})
const table = [columns].concat(rows)
- console.log('Copy', table)
+ const markdownData = MarkdownTable(table)
- // [Joshen TODO] Fix below
- // const markdownData = MarkdownTable(table)
-
- // copyToClipboard(markdownData, () => {
- // ui.setNotification({ category: 'success', message: 'Copied results to clipboard' })
- // Telemetry.sendEvent(
- // { category: 'sql_editor', action: 'sql_copy_as_markdown', label: '' },
- // ui.googleAnalyticsProps
- // )
- // })
+ copyToClipboard(markdownData, () => {
+ ui.setNotification({ category: 'success', message: 'Copied results to clipboard' })
+ Telemetry.sendEvent(
+ { category: 'sql_editor', action: 'sql_copy_as_markdown', label: '' },
+ ui.googleAnalyticsProps
+ )
+ })
}
}