Files
ComfyUI-Lora-Manager/static/js/managers/import/ImportStepManager.js
Will Miao 23fa2995c8 refactor(import): Implement DownloadManager, FolderBrowser, ImageProcessor, and RecipeDataManager for enhanced recipe import functionality
- Added DownloadManager to handle saving recipes and downloading missing LoRAs.
- Introduced FolderBrowser for selecting LoRA root directories and managing folder navigation.
- Created ImageProcessor for handling image uploads and URL inputs for recipe analysis.
- Developed RecipeDataManager to manage recipe details, including metadata and LoRA information.
- Implemented ImportStepManager to control the flow of the import process and manage UI steps.
- Added utility function for formatting file sizes for better user experience.
2025-05-08 15:41:13 +08:00

58 lines
2.0 KiB
JavaScript

export class ImportStepManager {
constructor() {
this.injectedStyles = null;
}
removeInjectedStyles() {
if (this.injectedStyles && this.injectedStyles.parentNode) {
this.injectedStyles.parentNode.removeChild(this.injectedStyles);
this.injectedStyles = null;
}
// Reset inline styles
document.querySelectorAll('.import-step').forEach(step => {
step.style.cssText = '';
});
}
showStep(stepId) {
// Remove any injected styles to prevent conflicts
this.removeInjectedStyles();
// Hide all steps first
document.querySelectorAll('.import-step').forEach(step => {
step.style.display = 'none';
});
// Show target step with a monitoring mechanism
const targetStep = document.getElementById(stepId);
if (targetStep) {
// Use direct style setting
targetStep.style.display = 'block';
// For the locationStep specifically, we need additional measures
if (stepId === 'locationStep') {
// Create a more persistent style to override any potential conflicts
this.injectedStyles = document.createElement('style');
this.injectedStyles.innerHTML = `
#locationStep {
display: block !important;
opacity: 1 !important;
visibility: visible !important;
}
`;
document.head.appendChild(this.injectedStyles);
// Force layout recalculation
targetStep.offsetHeight;
}
// Scroll modal content to top
const modalContent = document.querySelector('#importModal .modal-content');
if (modalContent) {
modalContent.scrollTop = 0;
}
}
}
}