feat: add spark table roll buttons for GMs
Introduces the ability for GMs to inject spark roll buttons into tables that match existing spark completions. - Replaces `linkPrefill` with a more flexible `actionPrefill` system to support multiple command types (e.g., `/link`, `/spark`). - Implements `injectSparkButtons` to identify spark tables in the DOM and insert action buttons. - Updates `JournalInput` to handle structured prefill actions.
This commit is contained in:
@@ -21,7 +21,7 @@ import {
|
||||
Match,
|
||||
} from "solid-js";
|
||||
import { sendMessage, useJournalStream } from "../stores/journalStream";
|
||||
import { linkPrefill, setLinkPrefill } from "../stores/reveal";
|
||||
import { actionPrefill, setActionPrefill } from "../stores/reveal";
|
||||
import { useJournalCompletions, ensureCompletions } from "./completions";
|
||||
import { resolveRollPayload } from "./types/roll";
|
||||
import { resolveSparkPayload } from "./types/spark";
|
||||
@@ -97,12 +97,12 @@ export const JournalInput: Component = () => {
|
||||
void ensureCompletions();
|
||||
});
|
||||
|
||||
// Listen for /link prefill requests from article headings
|
||||
// Listen for action prefill requests from article buttons (heading /link, spark table roll, etc.)
|
||||
createEffect(() => {
|
||||
const prefilled = linkPrefill();
|
||||
if (prefilled) {
|
||||
setText(prefilled);
|
||||
setLinkPrefill(null);
|
||||
const action = actionPrefill();
|
||||
if (action) {
|
||||
setText(`${action.command} ${action.text}`);
|
||||
setActionPrefill(null);
|
||||
textareaRef?.focus();
|
||||
}
|
||||
});
|
||||
@@ -498,7 +498,7 @@ export const JournalInput: Component = () => {
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder={
|
||||
isGm()
|
||||
? "Type a message, or /roll or /link..."
|
||||
? "Type a message, or /roll, /spark, or /link..."
|
||||
: "Type a message..."
|
||||
}
|
||||
rows={2}
|
||||
|
||||
Reference in New Issue
Block a user