mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
refactor(showcase): improve custom image identification logic in renderMediaItem and findLocalFile functions
This commit is contained in:
@@ -75,8 +75,6 @@ export function generateImageWrapper(media, heightPercent, shouldBlur, nsfwText,
|
|||||||
data-remote-src="${remoteUrl}"
|
data-remote-src="${remoteUrl}"
|
||||||
data-nsfw-level="${nsfwLevel}"
|
data-nsfw-level="${nsfwLevel}"
|
||||||
alt="Preview"
|
alt="Preview"
|
||||||
crossorigin="anonymous"
|
|
||||||
referrerpolicy="no-referrer"
|
|
||||||
width="${media.width}"
|
width="${media.width}"
|
||||||
height="${media.height}"
|
height="${media.height}"
|
||||||
class="lazy ${shouldBlur ? 'blurred' : ''}">
|
class="lazy ${shouldBlur ? 'blurred' : ''}">
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ function renderMediaItem(img, index, exampleFiles) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Determine if this is a custom image (has id property)
|
// Determine if this is a custom image (has id property)
|
||||||
const isCustomImage = Boolean(img.id);
|
const isCustomImage = Boolean(typeof img.id === 'string' && img.id);
|
||||||
|
|
||||||
// Create the media control buttons HTML
|
// Create the media control buttons HTML
|
||||||
const mediaControlsHtml = `
|
const mediaControlsHtml = `
|
||||||
@@ -235,7 +235,7 @@ function findLocalFile(img, index, exampleFiles) {
|
|||||||
|
|
||||||
let localFile = null;
|
let localFile = null;
|
||||||
|
|
||||||
if (img.id) {
|
if (typeof img.id === 'string' && img.id) {
|
||||||
// This is a custom image, find by custom_<id>
|
// This is a custom image, find by custom_<id>
|
||||||
const customPrefix = `custom_${img.id}`;
|
const customPrefix = `custom_${img.id}`;
|
||||||
localFile = exampleFiles.find(file => file.name.startsWith(customPrefix));
|
localFile = exampleFiles.find(file => file.name.startsWith(customPrefix));
|
||||||
|
|||||||
Reference in New Issue
Block a user