Fix ComfyUI workflow not saving

a410c63333069100aee6d4e4b54196cd6accfa24

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

1 files changed, +8 -3Ignore whitespace
public/scripts/extensions/stable-diffusion/index.js+8 -3
@@ -30,7 +30,7 @@ import { SlashCommand } from '../../slash-commands/SlashCommand.js';
30import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';30import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
31import { debounce_timeout } from '../../constants.js';31import { debounce_timeout } from '../../constants.js';
32import { SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js';32import { SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js';
33import { POPUP_TYPE, callGenericPopup } from '../../popup.js';33import { POPUP_TYPE, Popup, callGenericPopup } from '../../popup.js';
34export { MODULE_NAME };34export { MODULE_NAME };
3535
36const MODULE_NAME = 'sd';36const MODULE_NAME = 'sd';
@@ -2976,7 +2976,12 @@ async function onComfyOpenWorkflowEditorClick() {
2976 }),2976 }),
2977 })).json();2977 })).json();
2978 const editorHtml = $(await $.get('scripts/extensions/stable-diffusion/comfyWorkflowEditor.html'));2978 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();
2980 const checkPlaceholders = () => {2985 const checkPlaceholders = () => {
2981 workflow = $('#sd_comfy_workflow_editor_workflow').val().toString();2986 workflow = $('#sd_comfy_workflow_editor_workflow').val().toString();
2982 $('.sd_comfy_workflow_editor_placeholder_list > li[data-placeholder]').each(function (idx) {2987 $('.sd_comfy_workflow_editor_placeholder_list > li[data-placeholder]').each(function (idx) {
@@ -3045,7 +3050,7 @@ async function onComfyOpenWorkflowEditorClick() {
3045 headers: getRequestHeaders(),3050 headers: getRequestHeaders(),
3046 body: JSON.stringify({3051 body: JSON.stringify({
3047 file_name: extension_settings.sd.comfy_workflow,3052 file_name: extension_settings.sd.comfy_workflow,
3048 workflow: $('#sd_comfy_workflow_editor_workflow').val().toString(),3053 workflow: workflow,
3049 }),3054 }),
3050 });3055 });
3051 if (!response.ok) {3056 if (!response.ok) {