chore: refactored chat_editor

This commit is contained in:
2026-05-01 15:26:22 +02:00
parent cf3c598911
commit fbc1cba52e
8 changed files with 731 additions and 531 deletions

View File

@@ -74,9 +74,20 @@ for await (const line of rl) {
if (message.command === "native_menu_action") {
await page.evaluate((action) => {
window.dispatchEvent(new CustomEvent("bds:native-menu-action", { detail: { action } }));
return new Promise((resolve) => {
const ackId = `ack-${Date.now()}-${Math.random().toString(36).slice(2)}`;
const handler = (event) => {
if (event.detail?.ackId === ackId) {
window.removeEventListener("bds:native-menu-action-ack", handler);
resolve();
}
};
window.addEventListener("bds:native-menu-action-ack", handler);
window.dispatchEvent(
new CustomEvent("bds:native-menu-action", { detail: { action, ackId } })
);
});
}, message.action);
await page.waitForTimeout(50);
console.log(JSON.stringify({ ref, status: "ok", result: "ok" }));
continue;
}