Skip to content

Commit

Permalink
Remove debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
tmathern committed Aug 23, 2023
1 parent b0a4c0d commit e6edd54
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions blocks/aem-asset-selector/aem-asset-selector-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,6 @@ function getCopyRendition(asset) {
maxRendition = rendition;
}
});

console.log("~~~~~~~~~ Picked rendition: ")
console.log(maxRendition)
console.log("~~~~~~~~~ ")
return maxRendition;
}

Expand Down Expand Up @@ -259,10 +255,8 @@ async function loadImageIntoHtmlElement(url) {
* @returns A conversion promise resolving to a blob of the target mimetype
*/
async function convertImage(assetPublicUrl, targetMimeType='image/png', asset) {

Check failure on line 257 in blocks/aem-asset-selector/aem-asset-selector-util.js

View workflow job for this annotation

GitHub Actions / build

Default parameters should be last

Check failure on line 257 in blocks/aem-asset-selector/aem-asset-selector-util.js

View workflow job for this annotation

GitHub Actions / build

Operator '=' must be spaced
const main = document.querySelector('main');
const imageElement = await loadImageIntoHtmlElement(assetPublicUrl);

console.log('## convertImage: ', assetPublicUrl)
return new Promise(resolve => {

Check failure on line 260 in blocks/aem-asset-selector/aem-asset-selector-util.js

View workflow job for this annotation

GitHub Actions / build

Expected parentheses around arrow function argument
const canvas = document.createElement('canvas');
canvas.width = asset['tiff:imageWidth'];
Expand All @@ -284,8 +278,7 @@ async function convertImage(assetPublicUrl, targetMimeType='image/png', asset) {
*/
async function copyToClipboardWithBinary(assetPublicUrl, mimeType, asset) {
let data;
console.log("## copyToClipboardWithBinary")
console.log(mimeType);

if (!CLIPBOARD_SUPPORTED_BINARY_MIMETYPES.includes(mimeType)) {
const copiedBlob = await convertImage(assetPublicUrl, 'image/png', asset);

Expand Down Expand Up @@ -368,7 +361,7 @@ export async function copyAssetWithRapi(asset) {
}
const download = getRel(rendition, REL_DOWNLOAD);
if (!download || !download.href) {
console.log('Rendition does not contain sufficient information');
logMessage('Rendition does not contain sufficient information');
return false;
}
try {
Expand All @@ -379,17 +372,17 @@ export async function copyAssetWithRapi(asset) {
},
});
if (!res.ok) {
console.log(`Download request for rendition binary failed with status code ${res.status}: ${res.statusText}`);
logMessage(`Download request for rendition binary failed with status code ${res.status}: ${res.statusText}`);
return false;
}
const downloadJson = await res.json();
if (!downloadJson) {
console.log('Rendition download JSON not provided');
logMessage('Rendition download JSON not provided');
return false;
}
await copyToClipboardWithBinary(downloadJson.href, downloadJson.type, asset);
} catch (e) {
console.log('Error copying asset using R-API to clipboard', e);
logMessage('Error copying asset using R-API to clipboard', e);
return false;
}

Expand Down

0 comments on commit e6edd54

Please sign in to comment.