Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Allow copying debug prompts

Bitti212133939515
diff --git a/src/components/workspace/DebugPromptDialog.tsx b/src/components/workspace/DebugPromptDialog.tsx
index 9e24400..b912dc5 100644
--- a/src/components/workspace/DebugPromptDialog.tsx
+++ b/src/components/workspace/DebugPromptDialog.tsx
@@ -25,6 +25,18 @@ export function DebugPromptDialog({ sceneTitle, segments, onClose, title = "Debu
event.preventDefault();
event.stopPropagation();
onClose();
+ } else if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "a") {
+ event.preventDefault();
+ event.stopPropagation();
+ const element = prompt.current;
+ const selection = window.getSelection();
+ if (element && selection) {
+ element.focus();
+ const range = document.createRange();
+ range.selectNodeContents(element);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ }
} else if (event.key === "Tab") {
event.preventDefault();
(document.activeElement === closeButton.current ? prompt.current : closeButton.current)?.focus();
diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsx
index 3225add..f06ffd5 100644
--- a/src/components/workspace/GeneratorView.test.tsx
+++ b/src/components/workspace/GeneratorView.test.tsx
@@ -305,6 +305,8 @@ describe("Generator scene controls", () => {
expect(within(dialog).getByRole("button", { name: "Close debug prompt" })).toHaveFocus();
fireEvent.keyDown(window, { key: "Tab" });
expect(within(dialog).getByLabelText("The compiled MiniMax H3 prompt")).toHaveFocus();
+ fireEvent.keyDown(window, { key: "a", ctrlKey: true });
+ expect(window.getSelection()?.toString()).toBe(within(dialog).getByLabelText("The compiled MiniMax H3 prompt").textContent);
fireEvent.keyDown(window, { key: "Escape" });
expect(screen.queryByRole("dialog", { name: "Debug Prompt" })).not.toBeInTheDocument();
expect(button).toHaveFocus();
diff --git a/src/components/workspace/ReferencesView.test.tsx b/src/components/workspace/ReferencesView.test.tsx
index 53e00fc..3627fb8 100644
--- a/src/components/workspace/ReferencesView.test.tsx
+++ b/src/components/workspace/ReferencesView.test.tsx
@@ -75,6 +75,8 @@ describe("Reference type presets", () => {
expect(regenerate).not.toHaveBeenCalled();
fireEvent.keyDown(window, { key: "Tab" });
expect(within(dialog).getByLabelText("The reference icon generation prompt")).toHaveFocus();
+ fireEvent.keyDown(window, { key: "a", metaKey: true });
+ expect(window.getSelection()?.toString()).toBe(referenceIconPrompt(state.latest().references[0]));
fireEvent.keyDown(window, { key: "Escape" });
expect(screen.queryByRole("dialog", { name: "Debug Icon Prompt" })).not.toBeInTheDocument();
expect(button).toHaveFocus();
diff --git a/src/main.tsx b/src/main.tsx
index 0574209..9f65324 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -22,11 +22,11 @@ watchSystemTheme(() => {
/* Slopus is an application window, not a web page. The browser's own
context menu offers Back, Reload, View source and Inspect — none of which
mean anything here, and Reload throws away unsaved project edits. Text
- fields keep theirs: cut/copy/paste/undo are real editing commands, and
+ fields and compiled prompts keep theirs: copy/paste are useful here, and
taking them away would cost the user more than the menu is worth. */
document.addEventListener("contextmenu", (event) => {
const target = event.target as HTMLElement | null;
- if (target?.closest("input, textarea, [contenteditable='true']")) return;
+ if (target?.closest("input, textarea, [contenteditable='true'], .compiled-prompt__text")) return;
event.preventDefault();
});
diff --git a/src/styles/generator.css b/src/styles/generator.css
index fee4ca2..a20a83a 100644
--- a/src/styles/generator.css
+++ b/src/styles/generator.css
@@ -1461,6 +1461,7 @@
}
.compiled-prompt__text {
+ user-select: text;
max-height: 280px;
margin: 0;
overflow: auto;