2022-01-19 12:33:57 +00:00
|
|
|
import { TDExport } from '@tldraw/tldraw'
|
2022-01-10 16:36:28 +00:00
|
|
|
|
|
|
|
export const EXPORT_ENDPOINT =
|
|
|
|
process.env.NODE_ENV === 'development'
|
|
|
|
? 'http://localhost:3000/api/export'
|
|
|
|
: 'https://www.tldraw.com/api/export'
|
|
|
|
|
2022-05-11 13:25:08 +00:00
|
|
|
// export async function exportToImage(info: TDExport) {
|
|
|
|
// if (info.serialized) {
|
|
|
|
// const link = document.createElement('a')
|
|
|
|
// link.href = 'data:text/plain;charset=utf-8,' + encodeURIComponent(info.serialized)
|
|
|
|
// link.download = info.name + '.' + info.type
|
|
|
|
// link.click()
|
2022-01-10 16:36:28 +00:00
|
|
|
|
2022-05-11 13:25:08 +00:00
|
|
|
// return
|
|
|
|
// }
|
2022-01-10 16:36:28 +00:00
|
|
|
|
2022-05-11 13:25:08 +00:00
|
|
|
// const response = await fetch(EXPORT_ENDPOINT, {
|
|
|
|
// method: 'POST',
|
|
|
|
// headers: { 'Content-Type': 'application/json' },
|
|
|
|
// body: JSON.stringify(info),
|
|
|
|
// })
|
|
|
|
// const blob = await response.blob()
|
|
|
|
// const blobUrl = URL.createObjectURL(blob)
|
|
|
|
// const link = document.createElement('a')
|
|
|
|
// link.href = blobUrl
|
|
|
|
// link.download = info.name + '.' + info.type
|
|
|
|
// link.click()
|
|
|
|
// }
|