Event or method for when metadata is saved by the user on the dashboard?

Started by cmminear2 replies571 views
cmminearOriginal post
#1

Is there a method that you can use to catch which photo/upload had file meta data written to it. My dashboard has captions that can be added to it and I would like to add a little icon if an upload has a caption. Any tips or pointing to the docs that have this info would be appreciated. Thank you.

cmminear
#3

My crappy workaround that will inevitably break at some point:

  .on('dashboard:file-edit-complete', (file) => {
console.log('Modal saved', file)

items = uppy.getFiles()
console.log(items)

items.forEach(function (item, index) {
	console.log(index);
	console.log(item);
  pictureDiv = document.getElementById('uppy_'+item.id);
  uppyStatus = pictureDiv.querySelector('.uppy-DashboardItem-status');
  if (item.meta.caption && item.meta.caption != "" && uppyStatus.children[0].innerHTML.indexOf("Caption Added") === -1 ){
    uppyStatus.children[0].innerHTML = "<p style=\"font-size:10px; color:green; margin:0px\">Caption Added</p>";
  }else if (item.meta.caption == ""){
    uppyStatus.children[0].innerHTML = "";
  }
});

})