mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 23:25:43 -03:00
Remember sort by name/date in LoRAs page
This commit is contained in:
@@ -17,6 +17,7 @@ import { LoraContextMenu } from './components/ContextMenu.js';
|
|||||||
import { moveManager } from './managers/MoveManager.js';
|
import { moveManager } from './managers/MoveManager.js';
|
||||||
import { updateCardsForBulkMode } from './components/LoraCard.js';
|
import { updateCardsForBulkMode } from './components/LoraCard.js';
|
||||||
import { bulkManager } from './managers/BulkManager.js';
|
import { bulkManager } from './managers/BulkManager.js';
|
||||||
|
import { setStorageItem, getStorageItem } from './utils/storageHelpers.js';
|
||||||
|
|
||||||
// Initialize the LoRA page
|
// Initialize the LoRA page
|
||||||
class LoraPageManager {
|
class LoraPageManager {
|
||||||
@@ -63,7 +64,7 @@ class LoraPageManager {
|
|||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
// Initialize page-specific components
|
// Initialize page-specific components
|
||||||
initializeEventListeners();
|
this.initEventListeners();
|
||||||
restoreFolderFilter();
|
restoreFolderFilter();
|
||||||
initFolderTagsVisibility();
|
initFolderTagsVisibility();
|
||||||
new LoraContextMenu();
|
new LoraContextMenu();
|
||||||
@@ -77,15 +78,30 @@ class LoraPageManager {
|
|||||||
// Initialize common page features (lazy loading, infinite scroll)
|
// Initialize common page features (lazy loading, infinite scroll)
|
||||||
appCore.initializePageFeatures();
|
appCore.initializePageFeatures();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize event listeners
|
loadSortPreference() {
|
||||||
function initializeEventListeners() {
|
const savedSort = getStorageItem('loras_sort');
|
||||||
|
if (savedSort) {
|
||||||
|
state.sortBy = savedSort;
|
||||||
|
const sortSelect = document.getElementById('sortSelect');
|
||||||
|
if (sortSelect) {
|
||||||
|
sortSelect.value = savedSort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
saveSortPreference(sortValue) {
|
||||||
|
setStorageItem('loras_sort', sortValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
initEventListeners() {
|
||||||
const sortSelect = document.getElementById('sortSelect');
|
const sortSelect = document.getElementById('sortSelect');
|
||||||
if (sortSelect) {
|
if (sortSelect) {
|
||||||
sortSelect.value = state.sortBy;
|
sortSelect.value = state.sortBy;
|
||||||
|
this.loadSortPreference();
|
||||||
sortSelect.addEventListener('change', async (e) => {
|
sortSelect.addEventListener('change', async (e) => {
|
||||||
state.sortBy = e.target.value;
|
state.sortBy = e.target.value;
|
||||||
|
this.saveSortPreference(e.target.value);
|
||||||
await resetAndReload();
|
await resetAndReload();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -93,6 +109,7 @@ function initializeEventListeners() {
|
|||||||
document.querySelectorAll('.folder-tags .tag').forEach(tag => {
|
document.querySelectorAll('.folder-tags .tag').forEach(tag => {
|
||||||
tag.addEventListener('click', toggleFolder);
|
tag.addEventListener('click', toggleFolder);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize everything when DOM is ready
|
// Initialize everything when DOM is ready
|
||||||
|
|||||||
Reference in New Issue
Block a user