Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/web/src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ export default function Editor({
content,
onChange,
onBlur,
onModEnter,
readOnly = false,
workspaceMembers,
enableYouTubeEmbed = true,
Expand All @@ -449,6 +450,7 @@ export default function Editor({
content: string | null;
onChange?: (value: string) => void;
onBlur?: () => void;
onModEnter?: () => void;
readOnly?: boolean;
workspaceMembers: WorkspaceMember[];
enableYouTubeEmbed?: boolean;
Expand Down Expand Up @@ -570,6 +572,18 @@ export default function Editor({
attributes: {
class: "outline-none focus:outline-none focus-visible:ring-0",
},
handleKeyDown: (_view, event) => {
if (
onModEnter &&
event.key === "Enter" &&
(event.metaKey || event.ctrlKey)
) {
event.preventDefault();
onModEnter();
return true;
}
return false;
},
},
editable: !readOnly,
injectCSS: false,
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ export const env = createEnv({
S3_FORCE_PATH_STYLE: z.string().optional(),
EMAIL_FROM: z.string().optional(),
REDIS_URL: z.string().url().optional().or(z.literal("")),
// Webhook configuration
WEBHOOK_URL: z.string().url().optional(),
WEBHOOK_SECRET: z.string().optional(),
},

/**
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/views/card/components/NewCommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const NewCommentForm = ({
<Editor
content={watch("comment")}
onChange={(value) => setValue("comment", value)}
onModEnter={handleSubmit(onSubmit)}
workspaceMembers={workspaceMembers}
enableYouTubeEmbed={false}
placeholder={t`Add comment... (type '/' to open commands or '@' to mention)`}
Expand Down
25 changes: 24 additions & 1 deletion apps/web/src/views/card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Link from "next/link";
import { useRouter } from "next/router";
import { t } from "@lingui/core/macro";
import { useEffect, useState } from "react";
import { useCallback, useEffect, useMemo, useState } from "react";
import { useForm } from "react-hook-form";
import { HiXMark } from "react-icons/hi2";
import { IoChevronForwardSharp } from "react-icons/io5";
Expand All @@ -18,6 +18,10 @@ import { NewWorkspaceForm } from "~/components/NewWorkspaceForm";
import { PageHead } from "~/components/PageHead";
import { EditYouTubeModal } from "~/components/YouTubeEmbed/EditYouTubeModal";
import { usePermissions } from "~/hooks/usePermissions";
import {
useKeyboardShortcut,
type KeyboardShortcut,
} from "~/providers/keyboard-shortcuts";
import { useModal } from "~/providers/modal";
import { usePopup } from "~/providers/popup";
import { useWorkspace } from "~/providers/workspace";
Expand Down Expand Up @@ -210,6 +214,25 @@ export default function CardPage({ isTemplate }: { isTemplate?: boolean }) {
const workspaceMembers = board?.workspace.members;
const boardId = board?.publicId;

const navigateToBoard = useCallback(() => {
if (!isOpen && boardId) {
const boardPath = isTemplate ? "templates" : "boards";
void router.push(`/${boardPath}/${boardId}`);
}
}, [isOpen, isTemplate, boardId, router]);

const escShortcut = useMemo(
(): KeyboardShortcut => ({
type: "PRESS",
stroke: { key: "Escape" },
action: navigateToBoard,
description: t`Close card`,
group: "NAVIGATION",
}),
[navigateToBoard],
);
useKeyboardShortcut(escShortcut);

const editorWorkspaceMembers =
workspaceMembers
?.filter((member) => member.email)
Expand Down
2 changes: 2 additions & 0 deletions packages/db/src/repository/webhook.repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function parseEvents(raw: string): WebhookEvent[] {
return JSON.parse(raw) as WebhookEvent[];
}


export const create = async (
db: dbClient,
webhookInput: {
Expand Down Expand Up @@ -145,6 +146,7 @@ export const getAllByWorkspaceId = async (
* DO NOT expose this via tRPC or any client-facing endpoint.
* Use getAllByWorkspaceId (which omits secrets) for the admin list endpoint.
*/

export const getActiveByWorkspaceId = async (
db: dbClient,
workspaceId: number,
Expand Down
Loading