@eclipse-scout/core
Version:
Eclipse Scout runtime
50 lines • 2.16 kB
TypeScript
/// <reference types="jquery" />
import { Session, Status, Widget } from '../index';
export interface ClipboardTextCopyOptions {
/**
* The text to write to the clipboard.
*/
text: string;
/**
* Widget that wants to copy the text. Recommended.
* Used to retrieve the session and the document.
*/
parent?: Widget;
/**
* Scout session object, used to resolve texts and access the focus manager. Only required when "parent" is not set.
*/
session?: Session;
/**
* If true, a desktop notification is shown when copying has been completed. Requires the "parent" option to be present.
* If this is true, the {@link copyText} method returns null. Otherwise, it returns a promise that is resolved or rejected when the copying is complete.
*/
showNotification?: boolean;
}
export declare const clipboard: {
/**
* Copies the given text to the clipboard. To make this work, the method must be called inside
* a "user action" (i.e. mouse or keyboard event handler). For security reasons, the access to
* the clipboard is blocked by the browser in other contexts (e.g. asynchronous callbacks).
*
* @param options mandatory
* @returns a promise or null if {@link options.showNotification} is true.
*/
copyText(options: ClipboardTextCopyOptions): JQuery.Promise<void>;
/** @internal */
_copyText(options: ClipboardTextCopyOptions): JQuery.Promise<void>;
/** @internal */
_showNotification(options: ClipboardTextCopyOptions, promise: JQuery.Promise<void>): void;
/** @internal */
_successStatus(session: Session): Status;
/** @internal */
_failedStatus(session: Session): Status;
/**
* Shows a short desktop notification. By default, it informs the user that the content
* has been copied to the clipboard successfully. By passing a different status, the
* message can be changed.
*
* @param parent Widget that wants to show the notification. Mandatory. Required for NLS texts.
*/
showNotification(parent: Widget, status?: Status): void;
};
//# sourceMappingURL=clipboard.d.ts.map