Fix ComfyUI workflow not saving
| @@ -30,7 +30,7 @@ import { SlashCommand } from '../../slash-commands/SlashCommand.js'; | |||
| 30 | import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js'; | 30 | import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js'; |
| 31 | import { debounce_timeout } from '../../constants.js'; | 31 | import { debounce_timeout } from '../../constants.js'; |
| 32 | import { SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js'; | 32 | import { SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js'; |
| 33 | import { POPUP_TYPE, callGenericPopup } from '../../popup.js'; | 33 | import { POPUP_TYPE, Popup, callGenericPopup } from '../../popup.js'; |
| 34 | export { MODULE_NAME }; | 34 | export { MODULE_NAME }; |
| 35 | 35 | ||
| 36 | const MODULE_NAME = 'sd'; | 36 | const 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) { |