fix: disable pysssss autocomplete in Lora-related nodes

Disable PySSSS autocomplete functionality in:
- Lora Loader
- Lora Stacker
- WanVideo Lora Select node
This commit is contained in:
Will Miao
2025-08-19 08:54:12 +08:00
parent 05df40977d
commit 32d2b6c013
4 changed files with 22 additions and 5 deletions

View File

@@ -141,11 +141,18 @@ class AutoComplete {
}
getSearchTerm(value) {
const lastCommaIndex = value.lastIndexOf(',');
if (lastCommaIndex === -1) {
return value.trim();
// Use helper to get text before cursor for more accurate positioning
const beforeCursor = this.helper.getBeforeCursor();
if (!beforeCursor) {
return '';
}
return value.substring(lastCommaIndex + 1).trim();
// Split on multiple delimiters: comma, space, '>' and other common separators
const segments = beforeCursor.split(/[,\s>]+/);
// Return the last non-empty segment as search term
const lastSegment = segments[segments.length - 1] || '';
return lastSegment.trim();
}
async search(term = '') {
@@ -221,6 +228,13 @@ class AutoComplete {
if (this.dropdown.lastChild) {
this.dropdown.lastChild.style.borderBottom = 'none';
}
// Auto-select the first item with a small delay
if (this.items.length > 0) {
setTimeout(() => {
this.selectItem(0);
}, 100); // 50ms delay
}
}
highlightMatch(text, searchTerm) {