helix-importer-ui icon indicating copy to clipboard operation
helix-importer-ui copied to clipboard

[import] Extra downloaded resources do not have a preview

Open kptdobe opened this issue 1 year ago • 0 comments

You can use the following import.js to download all page images:

export default {
  transform: ({ document, url }) => {
    const result = [];
    const images = document.querySelectorAll('img');
    images.forEach((img) => {
      const u = new URL(img.src, url);
      const newPath = WebImporter.FileUtils.sanitizePath(u.pathname);
      const imgData = {
        path: newPath,
        from: img.src,
      };
      result.push(imgData);
    });

    return result;
  },
};

You can also follow instructions from https://github.com/adobe/helix-importer-ui/blob/main/docs/download-pdf.md to download the pdf. In both cases, no preview is available for those assets. For images, it would be great to preview the images in the Preview panel (and hide other tabs) and for PDF have a download link or something...

This is a nice to have, using the Save file locally option gives the asset.

kptdobe avatar Feb 15 '24 09:02 kptdobe