Four extensions each carried their own copy of the toast-or-console fallback, transform upload failures used a blocking alert(), and a failed video drop onto Load Video only logged to the console. They all go through showToast now, so every message looks and behaves the same.
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import { app } from "/scripts/app.js";
|
|
import { showToast } from "../shared/index.mjs";
|
|
import { openTransformEditorForNode } from "../shared/transform_editor.mjs";
|
|
|
|
// Alt+E opens the transform editor of the selected Crop + Rotate + Pad node.
|
|
// Registered through ComfyUI's command + keybinding system (never a raw key
|
|
// listener) so it appears in Settings -> Keybindings and stays rebindable.
|
|
|
|
function selectedTransformNode() {
|
|
const selected = Object.values(app.canvas?.selected_nodes ?? {});
|
|
return selected.find((node) => node?.__ausbossTransformState) ?? null;
|
|
}
|
|
|
|
function notify(detail) {
|
|
showToast({ detail, life: 3000 });
|
|
}
|
|
|
|
app.registerExtension({
|
|
name: "ausboss.editor.command",
|
|
commands: [
|
|
{
|
|
id: "AusBoss.OpenEditor",
|
|
label: "AusBoss: Open transform editor for the selected node",
|
|
function: () => {
|
|
const node = selectedTransformNode();
|
|
if (!node) {
|
|
notify("Select an AusBoss Crop + Rotate + Pad node first.");
|
|
return;
|
|
}
|
|
openTransformEditorForNode(node);
|
|
},
|
|
},
|
|
],
|
|
keybindings: [
|
|
{ combo: { key: "e", alt: true }, commandId: "AusBoss.OpenEditor" },
|
|
],
|
|
});
|