MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / addContextMenuHandler

Function addContextMenuHandler

renderer.js:16130–16171  ·  view source on GitHub ↗
(fileElement, filePath)

Source from the content-addressed store, hash-verified

16128
16129 const fileDetails = document.createElement('div');
16130 fileDetails.className = 'file-details';
16131 fileDetails.innerHTML = `<span class="directory-label">Size:
16132 <span>${file.size? formatFileSize(file.size): ''}</span>
16133 `;
16134 fileInfo.appendChild(fileDetails);
16135 fileElement.appendChild(fileInfo);
16136
16137 fileElement.addEventListener('click', () => {
16138 toggleModelSelection(fileElement, file.filePath);
16139 });
16140 // Designer info is now shown in metadata section, so we don't need it here
16141 // Removed redundant designer info display
16142
16143 if (!file.thumbnail &&!skipThumbnail) {
16144 const fileExtension = file.filePath.split('.').pop().toLowerCase();
16145 if (isEmbeddedImagePreviewExt(fileExtension)) {
16146 try {
16147 const images = await extractEmbeddedPreviewImages(file.filePath, fileExtension);
16148 if (images && images.length > 0) {
16149 const firstImage = images[0];
16150 console.log(`[DEBUG] renderFile: Using ${images.length} embedded image(s) from ${fileExtension.toUpperCase()}: ${file.filePath}`);
16151 const img = document.createElement('img');
16152 img.src = firstImage;
16153 img.className = 'model-thumbnail';
16154 thumbnailContainer.innerHTML = '';
16155 thumbnailContainer.appendChild(img);
16156 thumbnailContainer.classList.remove('loading');
16157
16158 await window.electron.addMultipleThumbnails(file.filePath, images);
16159 file.thumbnail = firstImage;
16160
16161 return fileElement;
16162 } else {
16163 console.log(`[DEBUG] renderFile: No embedded images found in 3MF: ${file.filePath}`);
16164 }
16165 } catch (imageError) {
16166 console.error('renderFile: Error checking for embedded image:', imageError);
16167 }
16168 }
16169
16170 try {
16171 const thumbnail = await new Promise((resolve, reject) => {
16172 renderQueue.push({
16173 filePath: file.filePath,
16174 container: thumbnailContainer,

Callers 3

renderFileFunction · 0.85
createModelItemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected