extensions/ipynb/src/notebookImagePaste.ts/CopyPasteEditProvider/provideDocumentPasteEdits
class CopyPasteEditProvider:	async provideDocumentPasteEdits(
		document: vscode.TextDocument,
		_ranges: readonly vscode.Range[],
		dataTransfer: vscode.DataTransfer,
		_token: vscode.CancellationToken
	): Promise<vscode.DocumentPasteEdit | undefined> {

		const enabled = vscode.workspace.getConfiguration('ipynb', document).get('pasteImagesAsAttachments.enabled', false);
		if (!enabled) {
			return undefined;
		}

		// get b64 data from paste
		// TODO: dataTransfer.get() limits to one image pasted
		const dataItem = dataTransfer.get('image/png');
		if (!dataItem) {
			return undefined;
		}
		const fileDataAsUint8 = await dataItem.asFile()?.data();
		if (!fileDataAsUint8) {
			return undefined;
		}

		// get filename data from paste
		const clipboardFilename = dataItem.asFile()?.name;
		if (!clipboardFilename) {
			return undefined;
		}
		const separatorIndex = clipboardFilename?.lastIndexOf('.');
		const filename = clipboardFilename?.slice(0, separatorIndex);
		const filetype = clipboardFilename?.slice(separatorIndex);
		if (!filename || !filetype) {
			return undefined;
		}

		const currentCell = this.getCellFromCellDocument(document);
		if (!currentCell) {
			return undefined;
		}
		const notebookUri = currentCell.notebook.uri;

		// create updated metadata for cell (prep for WorkspaceEdit)
		const b64string = encodeBase64(fileDataAsUint8);
		const startingAttachments = currentCell.metadata.attachments;
		const newAttachment = buildAttachment(b64string, currentCell, filename, filetype, startingAttachments);

		// build edits
		const nbEdit = vscode.NotebookEdit.updateCellMetadata(currentCell.index, newAttachment.metadata);
		const workspaceEdit = new vscode.WorkspaceEdit();
		workspaceEdit.set(notebookUri, [nbEdit]);

		// create a snippet for paste
		const pasteSnippet = new vscode.SnippetString();
		pasteSnippet.appendText('![');
		pasteSnippet.appendPlaceholder(`${clipboardFilename}`);
		pasteSnippet.appendText(`](attachment:${newAttachment.filename})`);

		return { insertText: pasteSnippet, additionalEdit: workspaceEdit };
	}