am-editor-001/docs/api/clipboard.md

1.1 KiB

Clipboard

Clipboard related operations

Type: ClipboardInterface

Constructor

new (editor: EditorInterface): CommandInterface

Method

getData

Get clipboard data

/**
 * Get clipboard data
 * @param event event
 */
getData(event: DragEvent | ClipboardEvent): ClipboardData;

write

Write to clipboard

/**
 * Write to clipboard
 * @param event event
 * @param range cursor, get the current cursor position by default
 * @param callback callback
 */
write(
    event: ClipboardEvent,
    range?: RangeInterface | null,
    callback?: (data: {html: string; text: string }) => void,
): void;

cut

Perform cut and paste operations at the current cursor position

/**
 * Perform cut and paste operations at the current cursor position
 */
cut(): void;

copy

copy

/**
 * Copy
 * @param data The data to be copied, which can be a node or a string
 * @param trigger Whether to trigger the clipping event and notify the plug-in to process the conversion
 * @returns returns whether the copy is successful
 */
copy(data: Node | string, trigger?: boolean): boolean;