Fix ComfyUI workflow not saving

a410c63333069100aee6d4e4b54196cd6accfa24

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +8 -3Showing whitespace changes
public/scripts/extensions/stable-diffusion/index.js+8 -3
@@ -30,7 +30,7 @@ import { SlashCommand } from '../../slash-commands/SlashCommand.js';
3030import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
3131import { debounce_timeout } from '../../constants.js';
3232import { SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js';
3333import { POPUP_TYPE, Popup, callGenericPopup } from '../../popup.js';
3434export { MODULE_NAME };
3535
3636const MODULE_NAME = 'sd';
@@ -2976,7 +2976,12 @@ async function onComfyOpenWorkflowEditorClick() {
29762976 }),
29772977 })).json();
29782978 const editorHtml = $(await $.get('scripts/extensions/stable-diffusion/comfyWorkflowEditor.html'));
2979- const popupResult = callGenericPopup(editorHtml, POPUP_TYPE.CONFIRM, '', { okButton: 'Save', cancelButton: 'Cancel', wide: true, large: true });
2979+ const saveValue = (/** @type {Popup} */ _popup) => {
2980+ workflow = $('#sd_comfy_workflow_editor_workflow').val().toString();
2981+ return true;
2982+ };
2983+ const popup = new Popup(editorHtml, POPUP_TYPE.CONFIRM, '', { okButton: 'Save', cancelButton: 'Cancel', wide: true, large: true, onClosing: saveValue });
2984+ const popupResult = popup.show();
29802985 const checkPlaceholders = () => {
29812986 workflow = $('#sd_comfy_workflow_editor_workflow').val().toString();
29822987 $('.sd_comfy_workflow_editor_placeholder_list > li[data-placeholder]').each(function (idx) {
@@ -3045,7 +3050,7 @@ async function onComfyOpenWorkflowEditorClick() {
30453050 headers: getRequestHeaders(),
30463051 body: JSON.stringify({
30473052 file_name: extension_settings.sd.comfy_workflow,
3048- workflow: $('#sd_comfy_workflow_editor_workflow').val().toString(),
3053+ workflow: workflow,
30493054 }),
30503055 });
30513056 if (!response.ok) {