feat: option to show markdown preview for super notes (skip e2e) (#2048)
This commit is contained in:
26
packages/web/src/javascripts/Utils/copyTextToClipboard.tsx
Normal file
26
packages/web/src/javascripts/Utils/copyTextToClipboard.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
export function fallbackCopyTextToClipboard(text: string) {
|
||||
const textArea = document.createElement('textarea')
|
||||
textArea.value = text
|
||||
textArea.style.top = '0'
|
||||
textArea.style.left = '0'
|
||||
textArea.style.position = 'fixed'
|
||||
document.body.appendChild(textArea)
|
||||
textArea.focus()
|
||||
textArea.select()
|
||||
try {
|
||||
document.execCommand('copy')
|
||||
} catch (err) {
|
||||
console.error('Unable to copy', err)
|
||||
}
|
||||
|
||||
document.body.removeChild(textArea)
|
||||
}
|
||||
|
||||
export function copyTextToClipboard(text: string) {
|
||||
if (!navigator.clipboard) {
|
||||
fallbackCopyTextToClipboard(text)
|
||||
return
|
||||
}
|
||||
|
||||
void navigator.clipboard.writeText(text)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export function spaceSeparatedStrings(...strings: string[]): string {
|
||||
return strings.join(' ')
|
||||
}
|
||||
Reference in New Issue
Block a user