josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
814 stars 108 forks source link

Allow to override the copy to clipboard function #425

Closed kimpixel closed 1 month ago

kimpixel commented 2 months ago

In some cases the editor runs in a uncontrolled iframe. without the allow="clipboard-read; clipboard-write" tag it was not posible to copy and paste.

a new parameter (callback) to overwrite the copy function will help to redirect the functionality to the parent frame.

josdejong commented 2 months ago

Thanks for reporting. Can you share a minimal code example demonstrating the issue? It sounds like defining this allow="clipboard-read; clipboard-write" for your iframe solves the problem, so is there actually an issue?

kimpixel commented 2 months ago

Try to copy on you own example: https://www.sveltelab.dev/q1l38ztdys4at87 Chrome ist effected.

"uncontrolled iframe" means - no access to the iframe itself.

josdejong commented 2 months ago

Thanks. I opened your example in both Firefox and Chrome, use tree mode, and copied something via both Ctrl+C and the Copy button in the context menu. Both work fine. Which steps do you exactly do that throw this issue?

josdejong commented 1 month ago

Closing due to lack of response. Please reopen if still relevant.