title: TinyMCE grab array data
body: <p>I have a TinyMCE button and it works apart from passing the data from the media gallery into a variable (to edit into the content).</p>
  
  <p>I have the following:</p>
  
  <pre><code>window.on('select', function(){
   var files = window.state().get('selection').toArray();
   console.log(files.id);
  });
  </code></pre>
  
  <p>which doesn't work, but if I change too:</p>
  
  <pre><code>window.on('select', function(){
   var files = window.state().get('selection').toArray();
   console.log(files);
  });
  </code></pre>
  
  <p>I get "array (object)" in the console.log and by opening the object I can see id is one of the "fields" available and has a value.</p>
  
  <p>The basic idea is the button (before this code) opens a media library (WordPress) and on selection of the images, it passes the ID's of the images to TinyMCE to print them (later) and the only part that's not working is the above.</p>
  
  <p>Anyone able to point me in the right direction (vanilla js not my forte and first time using tinymce)</p>