mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-26 19:44:57 +02:00
More clipboard write fixes, add utility function (#2286)
Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Asset, IntlString } from '@hcengineering/platform'
|
||||
import { copyTextToClipboard } from '@hcengineering/presentation'
|
||||
import { Button } from '@hcengineering/ui'
|
||||
|
||||
export let icon: Asset
|
||||
@@ -25,5 +26,5 @@
|
||||
{icon}
|
||||
kind={'transparent'}
|
||||
showTooltip={{ label: title, direction: 'bottom' }}
|
||||
on:click={() => navigator.clipboard.writeText(text)}
|
||||
on:click={() => copyTextToClipboard(text)}
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Doc, DocumentUpdate, Ref, RelatedDocument, TxOperations } from '@hcengineering/core'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { copyTextToClipboard, getClient } from '@hcengineering/presentation'
|
||||
import { Issue, Project, Sprint, Team, trackerId } from '@hcengineering/tracker'
|
||||
import { getCurrentLocation, getPanelURI, Location } from '@hcengineering/ui'
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
@@ -48,17 +48,7 @@ export async function copyToClipboard (object: Issue, ev: Event, { type }: { typ
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
// Chromium
|
||||
await navigator.clipboard.writeText(text)
|
||||
} catch {
|
||||
// Safari specific behavior
|
||||
// see https://bugs.webkit.org/show_bug.cgi?id=222262
|
||||
const clipboardItem = new ClipboardItem({
|
||||
'text/plain': Promise.resolve(text)
|
||||
})
|
||||
await navigator.clipboard.write([clipboardItem])
|
||||
}
|
||||
await copyTextToClipboard(text)
|
||||
}
|
||||
|
||||
export function generateIssueShortLink (issueId: string): string {
|
||||
|
||||
Reference in New Issue
Block a user