Path: blob/main/src/vs/platform/clipboard/common/clipboardService.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { URI } from '../../../base/common/uri.js';6import { createDecorator } from '../../instantiation/common/instantiation.js';78export const IClipboardService = createDecorator<IClipboardService>('clipboardService');910export interface IClipboardService {1112readonly _serviceBrand: undefined;1314/**15* Trigger the paste. Returns undefined if the paste was not triggered or a promise that resolves on paste end.16*/17triggerPaste(targetWindowId: number): Promise<void> | undefined;1819/**20* Writes text to the system clipboard.21*/22writeText(text: string, type?: string): Promise<void>;2324/**25* Reads the content of the clipboard in plain text26*/27readText(type?: string): Promise<string>;2829/**30* Reads text from the system find pasteboard.31*/32readFindText(): Promise<string>;3334/**35* Writes text to the system find pasteboard.36*/37writeFindText(text: string): Promise<void>;3839/**40* Writes resources to the system clipboard.41*/42writeResources(resources: URI[]): Promise<void>;4344/**45* Reads resources from the system clipboard.46*/47readResources(): Promise<URI[]>;4849/**50* Find out if resources are copied to the clipboard.51*/52hasResources(): Promise<boolean>;5354/**55* Resets the internal state of the clipboard (if any) without touching the real clipboard.56*57* Used for implementations such as web which do not always support using the real clipboard.58*/59clearInternalState?(): void;6061/**62* Reads resources from the system clipboard as an image. If the clipboard does not contain an63* image, an empty buffer is returned.64*/65readImage(): Promise<Uint8Array>;66}676869