Detect changes using the sdk

  • 30 October 2020
  • 2 replies
  • 637 views

I am writing a plugin that detects changes in a board (widget created, deleted, etc), and I want to take a screenshot of the change.The plugin can detect those changes, but I am stuck at the screenshot part. I have tried to integrate an iframe in the plugin but with no success. I want to ask you what ideas would you suggest?


2 replies

Userlevel 7
Badge +5

@Andrei J 

I’ll take a shot at answering this question.. Keep in mind - I’m by no means a long-robed web wizard and might be overlooking some darker magic. 
 

Your plugin is IFramed into Miro at one of the Miro-enabled UI extension points. Your plugin is a resource in one domain, Miro is in another. Cross domain access is strictly controlled on the web. See this stackoverflow article for a bit more context there... 
 

https://stackoverflow.com/questions/2620755/how-is-it-possible-for-an-iframe-to-access-its-parents-dom


The only way your plugin iframe can access content in its parent frame is through methods enabled in the Miro sdk- which you load into your plugin. So … a screenshot of the parent frame (board) will be forbidden until it is a method made possible by the Miro SDK. 

Alternatively - you may find another way to store the changing board state (and log diffs between states) by storing what you can access → the board/widget data representation.  

hope this helps :)

 

Userlevel 7
Badge +5

@Andrei J  

So - you got me thinking … ‘what happens when you run the ‘web page capture’ plugin (native to miro) on a Miro board itself ? ‘  … hadn’t run this experiment.   This might have been what you were trying to do. 

 

 

Original Board: 

 

 

Web Capture image imported into board:   Amusing behavior: When you run the ‘Web Capture’ command on a board an anonymous user shows up in the board temporarily…like a photographer or something … ha!  

It actually does capture the board content but from the view of an anonymous new miro user and fills it with the lower left black ‘Welcome to Miro!’ help pane.  Not great… but lets go see what the SDK offers for the Web screen shot widget. …. 

 

 

I hadn’t tried using that method yet. It was on my ‘to do soon’ list. 

 

Unfortunately, I get an error message from Miro:

 “Sorry, miro.board.widgets.create() does not support widgetType ‘WEBSCREEN’ yet”

 

@Sultan / @Boris Borodyansky  -- Do you believe that widgets.create()should in fact offer creation of widgetType “WEBSCREEN” ? 

 

--

PREVIEW - results in the same error. 
 

 

Reply