Open Zlaojie opened 3 weeks ago
I did via event on the editor container where I had to override the addEventListener
so I could abort calling the native one on paste with files.
in the chat editor they do it by navigator.clipboard.read()
but that requires elevated rights.
I spose what we need is access to the registerDocumentPasteEditProvider
so we can add our own pasters with pasteMimeTypes
etc - could also be nice for making e.g. html -> markdown conversions on paste.
Context
Description
paste event result carries native clipboard event attribute. But if i paste a picture, monaco's onDidPaste can only obtain text and cannot obtain clipboard objects.
this.editor.onDidPaste((e) => { console.log(e.clipboardEvent.clipboardData?.items); // e.clipboardEvent.clipboardData?.items always return an empty array //do some things ,such as upload files from clipboardEvent });
Monaco Editor Playground Link
No response
Monaco Editor Playground Code
No response