mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
feat(context-menu): pass file path to NSFW level selector
- Add `cardPath` parameter to `show` method in NsfwLevelSelector component - Include `filePath` from card dataset when calling selector in ModelContextMenuMixin - Clear `cardPath` from dataset when hiding selector to prevent stale data This enables the NSFW level selector to access the file path context, which may be needed for backend operations when changing NSFW levels.
This commit is contained in:
@@ -55,6 +55,7 @@ export const ModelContextMenuMixin = {
|
||||
const filePath = card.dataset.filepath;
|
||||
selector.show({
|
||||
currentLevel,
|
||||
cardPath: filePath,
|
||||
onSelect: async (level) => {
|
||||
if (!filePath) return false;
|
||||
try {
|
||||
|
||||
@@ -26,6 +26,7 @@ function buildController(selectorElement) {
|
||||
|
||||
const hide = () => {
|
||||
selectorElement.style.display = 'none';
|
||||
selectorElement.dataset.cardPath = '';
|
||||
isOpen = false;
|
||||
if (typeof onClose === 'function') {
|
||||
onClose();
|
||||
@@ -34,11 +35,12 @@ function buildController(selectorElement) {
|
||||
onClose = null;
|
||||
};
|
||||
|
||||
const show = ({ currentLevel = 0, onSelect: selectCb, onClose: closeCb, multipleLabel = '' } = {}) => {
|
||||
const show = ({ currentLevel = 0, onSelect: selectCb, onClose: closeCb, multipleLabel = '', cardPath = '' } = {}) => {
|
||||
onSelect = selectCb || null;
|
||||
onClose = closeCb || null;
|
||||
isOpen = true;
|
||||
ignoreNextOutside = true; // ignore the click that triggered open
|
||||
selectorElement.dataset.cardPath = cardPath || '';
|
||||
|
||||
// Position near center of viewport
|
||||
const viewportWidth = document.documentElement.clientWidth;
|
||||
|
||||
Reference in New Issue
Block a user