Add right-click Copy Image to diagrams
This commit is contained in:
@@ -31,6 +31,16 @@ func copyToClipboard(_ text: String) {
|
||||
NSPasteboard.general.setString(text, forType: .string)
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func copyToClipboard(_ image: PlatformImage) {
|
||||
NSPasteboard.general.clearContents()
|
||||
NSPasteboard.general.writeObjects([image])
|
||||
}
|
||||
|
||||
func platformImage(_ cg: CGImage) -> PlatformImage {
|
||||
NSImage(cgImage: cg, size: NSSize(width: cg.width / 2, height: cg.height / 2))
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func openExternal(_ url: URL) {
|
||||
NSWorkspace.shared.open(url)
|
||||
@@ -96,6 +106,15 @@ func copyToClipboard(_ text: String) {
|
||||
UIPasteboard.general.string = text
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func copyToClipboard(_ image: PlatformImage) {
|
||||
UIPasteboard.general.image = image
|
||||
}
|
||||
|
||||
func platformImage(_ cg: CGImage) -> PlatformImage {
|
||||
UIImage(cgImage: cg, scale: 2, orientation: .up)
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func openExternal(_ url: URL) {
|
||||
UIApplication.shared.open(url)
|
||||
|
||||
Reference in New Issue
Block a user