Skip to main content

Hi

I’m trying to get the clipboard data when I click the button on the miro plugin.

I used this code for get clipboard data.

document.addEventListener('paste', event => createStickyNote(event))

function createStickyNote(event) {

      var text = e.clipboardData.getData('Text');

      console.log(text)

}

It works when I press Ctrl+V.

but I want to get the clipboard data when I click the button.

Please let me know your ideas,

Thank you

Hey @Maxim Huryanov 

You’ll want to tap into the “icon:click” event from Miro. This is the code that runs when the icon is clicked, and instead of opening a panel, you can run the code you have defined above. 

 

You can find more info here! https://developers.miro.com/docs/add-icon-click-to-your-app#add-the-iconclick-event


Hi @Addison Schultz 

I want to get the clipboard data when I click the button on the plugin panel, not miro toolbar icon.

Please check out this screenshot and let me know your thought.

 


Hi @Maxim Huryanov - You’re the one who developed the app, right? It looks like this app is also still V1. 

Can I ask how you added the icon there in the first place? 


@Addison Schultz 

Yeah you are right, this app is still use V1.1

It seems like it is impossible to display the paste icon near the close button on V2.

but it’s possible when I use V1.1

Now I’m trying to convert this app version 1.1 to 2.0

 


@Addison Schultz 

As I mentioned If I press CTRL+V, it is possible to get the clipboard.

but I need to get the clipboard data when I click ‘Paste’ button.

Normally I used this code for get the clipboard.

navigator.clipboard.readText()
.then(text => {)
console.log(text)
})

but it doesn’t work on miro plugin.

Please let me know your ideas.

Thank you


Hey Maxim - Right now in V2 we don’t have a way to add an icon next to the X icon. Are you able to move the “Paste Button” somewhere else in the UI? 

I’ve also been looking into this a bit more. It looks like it’s being blocked as SDK apps are running in an iFrame container on the Miro board, and by default this action (reading/writing to clipboard) is blocked from iFrames automatically due to security reasons. 

I found this for more info: https://hellodevworld.com/misc/copying-to-clipboard-from-iframe

Was this working for you before?


Hi @Addison Schultz 

Please check it out and let me know your thought.

 


Hey Maxim - I do think this would be a nice addition feature wise, so I’ve collected your feedback and passed it to the team. It’s something we’ll have to look into in order for us to implement, but I’ve got all the context needed for the team. 

Thanks for the idea!


Thank you so much


Reply