mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 22:52:12 -03:00
style(settings): restyle settings location shortcut
This commit is contained in:
@@ -23,6 +23,48 @@
|
||||
max-width: 650px; /* Further increased from 600px for more space */
|
||||
}
|
||||
|
||||
.settings-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: var(--space-1);
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
|
||||
.settings-header h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.settings-open-location-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--text-color);
|
||||
opacity: 0.6;
|
||||
cursor: pointer;
|
||||
border-radius: var(--border-radius-xs);
|
||||
transition: opacity 0.2s ease, background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.settings-open-location-button:hover,
|
||||
.settings-open-location-button:focus-visible {
|
||||
opacity: 1;
|
||||
background-color: rgba(var(--border-color-rgb, 148, 163, 184), 0.2);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.settings-open-location-button i {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.settings-open-location-button:focus-visible {
|
||||
box-shadow: 0 0 0 2px rgba(var(--border-color-rgb, 148, 163, 184), 0.6);
|
||||
}
|
||||
|
||||
/* Settings Links */
|
||||
.settings-links {
|
||||
margin-top: var(--space-3);
|
||||
|
||||
@@ -183,6 +183,14 @@ export class SettingsManager {
|
||||
button.addEventListener('click', () => this.toggleInputVisibility(button));
|
||||
});
|
||||
|
||||
const openSettingsLocationButton = document.querySelector('.settings-open-location-button');
|
||||
if (openSettingsLocationButton) {
|
||||
openSettingsLocationButton.addEventListener('click', () => {
|
||||
const filePath = openSettingsLocationButton.dataset.settingsPath;
|
||||
this.openSettingsFileLocation(filePath);
|
||||
});
|
||||
}
|
||||
|
||||
['lora', 'checkpoint', 'embedding'].forEach(modelType => {
|
||||
const customInput = document.getElementById(`${modelType}CustomTemplate`);
|
||||
if (customInput) {
|
||||
@@ -210,6 +218,32 @@ export class SettingsManager {
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
async openSettingsFileLocation(filePath) {
|
||||
if (!filePath) {
|
||||
showToast('settings.openSettingsFileLocation.failed', {}, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/lm/open-file-location', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ file_path: filePath }),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Request failed with status ${response.status}`);
|
||||
}
|
||||
|
||||
showToast('settings.openSettingsFileLocation.success', {}, 'success');
|
||||
} catch (error) {
|
||||
console.error('Failed to open settings file location:', error);
|
||||
showToast('settings.openSettingsFileLocation.failed', {}, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async loadSettingsToUI() {
|
||||
// Set frontend settings from state
|
||||
const blurMatureContentCheckbox = document.getElementById('blurMatureContent');
|
||||
|
||||
Reference in New Issue
Block a user