Add keyboard shortcut for info sheet and fix input field shortcut blocki
This commit is contained in:
@@ -209,14 +209,18 @@ Only return the JSON, no other text.`;
|
||||
}
|
||||
|
||||
const parsed = JSON.parse(jsonMatch[0]);
|
||||
const rawTitle = parsed.title?.trim() || (prompt.length > 50 ? prompt.substring(0, 50) + "..." : prompt);
|
||||
const rawTitle =
|
||||
parsed.title?.trim() ||
|
||||
(prompt.length > 50 ? prompt.substring(0, 50) + "..." : prompt);
|
||||
const rawDescription = parsed.description?.trim();
|
||||
|
||||
// Enforce character limits
|
||||
const title = rawTitle.length > 60 ? rawTitle.substring(0, 57) + "..." : rawTitle;
|
||||
const description = rawDescription && rawDescription.length > 200
|
||||
? rawDescription.substring(0, 197) + "..."
|
||||
: rawDescription;
|
||||
const title =
|
||||
rawTitle.length > 60 ? rawTitle.substring(0, 57) + "..." : rawTitle;
|
||||
const description =
|
||||
rawDescription && rawDescription.length > 200
|
||||
? rawDescription.substring(0, 197) + "..."
|
||||
: rawDescription;
|
||||
|
||||
return {
|
||||
title,
|
||||
@@ -309,7 +313,11 @@ Only return the JSON, no other text.`;
|
||||
description: generatedDescription,
|
||||
});
|
||||
// Update story object for response
|
||||
story = { ...story, title: generatedTitle, description: generatedDescription };
|
||||
story = {
|
||||
...story,
|
||||
title: generatedTitle,
|
||||
description: generatedDescription,
|
||||
};
|
||||
} catch (dbError) {
|
||||
console.error("Error updating story title/description:", dbError);
|
||||
// Continue even if update fails
|
||||
|
||||
@@ -113,10 +113,22 @@ export function StoryEditorClient() {
|
||||
// Keyboard navigation
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
// Don't trigger shortcuts if user is typing in an input field
|
||||
const target = e.target as HTMLElement;
|
||||
if (
|
||||
target.tagName === "INPUT" ||
|
||||
target.tagName === "TEXTAREA" ||
|
||||
target.isContentEditable
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.key === "ArrowRight") {
|
||||
setCurrentPage((prev) => (prev < pages.length - 1 ? prev + 1 : prev));
|
||||
} else if (e.key === "ArrowLeft") {
|
||||
setCurrentPage((prev) => (prev > 0 ? prev - 1 : prev));
|
||||
} else if (e.key === "i" || e.key === "I") {
|
||||
setShowInfoSheet(true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user