Pasting of URLs

Hello,

while cutting URLs in the Edge browser, some meta information (like title) is added:
https://support.microsoft.com/en-us/microsoft-edge/improved-copy-and-paste-of-urls-in-microsoft-edge-d3bd3956-603a-0033-1fbc-9588a30645b4

I already used it in another project to paste links directly with the corresponding title:
https://codeberg.org/avanc/kdb-client/commit/5dbf6f7874a67a952e1ca2644553d70052d546a7

Now I'm thinking to add this also to Joplin as plugin. However, I'm not sure if a plugin can get the clipboard data or if it has to be integrated directly into Joplin.

Any hints are welcome so that I'm not wasting time by implementing in the wrong direction.

Thanks,
Sven

Here's a link to the clipboard documentation.

And here is an example plugin that uses the clipboard api.

So I think what you suggest is possible. The only catch is that maybe you need to give it a custom keybindings (e.g. ctrl+alt+v for pasting).

You might also be interested in this discussion about additional clipboard data and how it might be implemented.

Thanks for the hints. This helped a lot to understand how pasting could work.

As next step I now diggign into how to react on paste event. As it is not possible to get the paste event from Joplin, I'm now looking into get that event from CodeMirror:
https://stackoverflow.com/a/36388061
https://codemirror.net/5/doc/manual.html#events

Hm, my test plugin gets CodeMirror scroll event as well as key event, but copy and paste events are not working:
https://codeberg.org/avanc/joplin-plugin-URLpaste/src/branch/main/src/URLPastePlugin.ts