Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
ComfyUI のトップバーメニューにカスタムコマンドを追加します。既存メニューへの追加、サブメニューの作成、1 つのコマンドを複数箇所に配置する方法を含みます。
app.registerExtension({ name: "MyExtension", // コマンドの定義 commands: [ { id: "myCommand", label: "マイコマンド", function: () => { alert("コマンドが実行されました!"); } } ], // コマンドをメニューに追加 menuCommands: [ { path: ["拡張機能", "マイ拡張機能"], commands: ["myCommand"] } ] });
id
label
function
{ id: string, // コマンドの一意の識別子 label: string, // コマンドの表示名 function: () => void // コマンドがトリガーされたときに実行される関数 }
menuCommands
{ path: string[], // メニュー階層を表す配列 commands: string[] // この場所に追加するコマンド ID の配列 }
path
["ファイル", "エクスポート"]
app.registerExtension({ name: "MenuExamples", commands: [ { id: "saveAsImage", label: "画像として保存", function: () => { // キャンバスを画像として保存するコード } }, { id: "exportWorkflow", label: "ワークフローをエクスポート", function: () => { // ワークフローをエクスポートするコード } } ], menuCommands: [ // ファイルメニューに追加 { path: ["ファイル"], commands: ["saveAsImage", "exportWorkflow"] } ] });
app.registerExtension({ name: "SubmenuExample", commands: [ { id: "option1", label: "オプション 1", function: () => { console.log("オプション 1"); } }, { id: "option2", label: "オプション 2", function: () => { console.log("オプション 2"); } }, { id: "suboption1", label: "サブオプション 1", function: () => { console.log("サブオプション 1"); } } ], menuCommands: [ // ネストされたメニュー構造を作成 { path: ["拡張機能", "マイツール"], commands: ["option1", "option2"] }, { path: ["拡張機能", "マイツール", "詳細"], commands: ["suboption1"] } ] });
app.registerExtension({ name: "MultiLocationExample", commands: [ { id: "helpCommand", label: "ヘルプを取得", function: () => { window.open("https://docs.example.com", "_blank"); } } ], menuCommands: [ // ヘルプメニューに追加 { path: ["ヘルプ"], commands: ["helpCommand"] }, // 拡張機能メニューにも追加 { path: ["拡張機能"], commands: ["helpCommand"] } ] });