From 8d86b6b533de304712d1db103da478f9b5cd58c3 Mon Sep 17 00:00:00 2001 From: Asad Saleem Date: Tue, 13 Aug 2024 13:57:18 +0500 Subject: [PATCH] open last accessed folder --- .../experience/editors/cloudinary/mediaSelector.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cartridges/bm_cloudinary_pd/cartridge/static/default/experience/editors/cloudinary/mediaSelector.js b/cartridges/bm_cloudinary_pd/cartridge/static/default/experience/editors/cloudinary/mediaSelector.js index 6ea601f..27cefbf 100644 --- a/cartridges/bm_cloudinary_pd/cartridge/static/default/experience/editors/cloudinary/mediaSelector.js +++ b/cartridges/bm_cloudinary_pd/cartridge/static/default/experience/editors/cloudinary/mediaSelector.js @@ -116,6 +116,12 @@ showError('Wrong asset type.'); } else { isAssetRestricted(config.assetInfoUrl, asset).then(((restricted) => { + if (asset.resource_type === 'image') { + localStorage.setItem('imagePath', asset.public_id.substring(0, asset.public_id.lastIndexOf('/'))); + } else { + localStorage.setItem('videoPath', asset.public_id.substring(0, asset.public_id.lastIndexOf('/'))); + } + if (!restricted) { emit({ type: 'sfcc:valid', @@ -159,7 +165,7 @@ } else { show.folder = { resource_type: config.type, - path: null + path: config.type === 'image' ? localStorage.getItem('imagePath') : localStorage.getItem('videoPath') }; }