Compare commits

..

No commits in common. "b8cfb05e5311633a4314c8fa39b93d0b6cf2103f" and "6d0bd75cb61860d97698f4d5b04ad7b785c00d0d" have entirely different histories.

3 changed files with 11 additions and 48 deletions

View File

@ -208,8 +208,16 @@ export function scanDirectives(
const [, headerRow, separatorRow, bodyRowsText] = mdMatch; const [, headerRow, separatorRow, bodyRowsText] = mdMatch;
const headers = splitTableRow(headerRow); const headers = splitTableRow(headerRow);
// Check if this looks like a spark table: first column is a dice formula // Check if this is a spark-shaped table: first column is a dice formula
const isSpark = DICE_HEADER_RE.test(headers[0]); // and one of the headers is a label marker
const isSpark =
DICE_HEADER_RE.test(headers[0]) &&
headers.some(
(h) =>
h === "label" ||
h === "md-table-label" ||
h === "md-roll-label",
);
if (!isSpark) continue; if (!isSpark) continue;

View File

@ -1,30 +0,0 @@
/**
* ErrorPopup shows the full error message in a floating panel above
* the journal input area. Toggled by clicking the truncated error text.
*/
import { Component, Show } from "solid-js";
interface ErrorPopupProps {
message: string | null;
show: boolean;
onClose: () => void;
}
export const ErrorPopup: Component<ErrorPopupProps> = (props) => {
return (
<Show when={props.show && props.message}>
<div class="absolute bottom-full left-2 right-2 mb-1 bg-red-50 border border-red-200 rounded shadow-lg z-50">
<div class="flex items-start justify-between px-2 pt-2 pb-1">
<p class="text-red-700 text-xs break-words">{props.message}</p>
<button
onClick={props.onClose}
class="text-red-400 hover:text-red-600 text-xs leading-none ml-2 shrink-0"
title="关闭"
>
</button>
</div>
</div>
</Show>
);
};

View File

@ -26,7 +26,6 @@ import { parseInput } from "./command-parser";
import type { CompletionItem } from "./command-parser"; import type { CompletionItem } from "./command-parser";
import { buildCompletions } from "./command-completions"; import { buildCompletions } from "./command-completions";
import { CompletionsDropdown } from "./CompletionsDropdown"; import { CompletionsDropdown } from "./CompletionsDropdown";
import { ErrorPopup } from "./ErrorPopup";
// ---- Component ---- // ---- Component ----
@ -40,7 +39,6 @@ export const JournalInput: Component = () => {
const [text, setText] = createSignal(""); const [text, setText] = createSignal("");
const [error, setError] = createSignal<string | null>(null); const [error, setError] = createSignal<string | null>(null);
const [showErrorPopup, setShowErrorPopup] = createSignal(false);
const [sending, setSending] = createSignal(false); const [sending, setSending] = createSignal(false);
const [showCompletions, setShowCompletions] = createSignal(false); const [showCompletions, setShowCompletions] = createSignal(false);
const [selectedIdx, setSelectedIdx] = createSignal(0); const [selectedIdx, setSelectedIdx] = createSignal(0);
@ -408,13 +406,7 @@ export const JournalInput: Component = () => {
<div class="flex items-center justify-between px-2 pb-2"> <div class="flex items-center justify-between px-2 pb-2">
<Show when={error()}> <Show when={error()}>
<button <p class="text-red-500 text-xs truncate max-w-[60%]">{error()}</p>
onClick={() => setShowErrorPopup((v) => !v)}
class="text-red-500 text-xs truncate max-w-[60%] text-left hover:underline"
title={error() ?? undefined}
>
{error()}
</button>
</Show> </Show>
<div class="flex items-center gap-1 ml-auto"> <div class="flex items-center gap-1 ml-auto">
<button <button
@ -430,13 +422,6 @@ export const JournalInput: Component = () => {
</div> </div>
</Show> </Show>
</div> </div>
{/* Error popup */}
<ErrorPopup
message={error()}
show={showErrorPopup()}
onClose={() => setShowErrorPopup(false)}
/>
</div> </div>
); );
}; };