webview optimize

This commit is contained in:
zombieyang
2025-04-08 20:19:12 +08:00
parent 5d69014506
commit d40cefb070
3 changed files with 4 additions and 9 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ declare module "SDPPPInternal" {
workflowAgentSID: string,
setWorkflowAgentSID: (workflowAgentSID: string) => void,
showWebviewDialog: () => void;
toggleWebviewDialog: () => void;
}
export function useSDPPPComfyCaller(): {
@@ -1,5 +1,3 @@
// @ts-ignore
import { ComfyLogin } from "./SDPPPInternalBridge.js";
import { useSDPPPContext } from "./SDPPPInternalBridge.js";
import i18n, { isValidI18nKey } from "../../../common/i18n.mjs";
import WebPageList from "./WebPageList.js";
@@ -31,7 +29,7 @@ export function Content({
webviewAgentSID,
lastConnectErrorMessage,
showWebviewDialog,
toggleWebviewDialog,
} = useSDPPPContext();
@@ -68,9 +66,6 @@ export function Content({
</div>
) : ''
}
{!editorMode && (initAfter4s || webviewAgentSID) && <ComfyLogin
onRequestLogin={() => { showWebviewDialog() }}
/>}
<sp-divider size="small"></sp-divider>
@@ -85,13 +85,13 @@ const AutoRunButtons = () => {
// 编辑按钮
const EditButton = () => {
const { workflowAgentSID, webviewAgentSID, showWebviewDialog } = useSDPPPContext();
const { workflowAgentSID, webviewAgentSID, toggleWebviewDialog } = useSDPPPContext();
const usingWebview = workflowAgentSID == webviewAgentSID;
return (
<sp-action-button
{...(!usingWebview ? { disabled: true } : {})}
onClick={() => { showWebviewDialog() }}
onClick={() => { toggleWebviewDialog() }}
title={!usingWebview ? i18n('disabled when running in browser page') : i18n('Edit in ComfyUI')}
>
<WebEditIcon />