The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix tests
Pedro Ladeira940f991d7976
diff --git a/apps/web/tests/partner-groups/lander-markdown.test.ts b/apps/web/tests/partner-groups/lander-markdown.test.tsindex 13c944f4de..d212afc0ab 100644--- a/apps/web/tests/partner-groups/lander-markdown.test.ts+++ b/apps/web/tests/partner-groups/lander-markdown.test.ts@@ -1,9 +1,12 @@-import { LANDER_RICH_TEXT_FEATURES } from "@/ui/partners/groups/design/lander/lander-rich-text-editor";-import { LANDER_MARKDOWN_ALLOWED_ELEMENTS } from "@/ui/partners/lander/blocks/block-markdown";-import type { RichTextFeature } from "@dub/ui";+import {+ LANDER_MARKDOWN_ALLOWED_ELEMENTS,+ LANDER_RICH_TEXT_FEATURES,+} from "@/ui/partners/lander/lander-markdown";import { describe, expect, test } from "vitest";-const FEATURE_FOR_ELEMENT: Record<string, RichTextFeature | null> = {+type LanderRichTextFeature = (typeof LANDER_RICH_TEXT_FEATURES)[number];++const FEATURE_FOR_ELEMENT: Record<string, LanderRichTextFeature | null> = {h1: "headings",h2: "headings",h3: "headings",@@ -37,7 +40,10 @@ describe("lander markdown", () => {test("every renderable element has a matching editor feature", () => {const missing = LANDER_MARKDOWN_ALLOWED_ELEMENTS.filter((element) => {const feature = FEATURE_FOR_ELEMENT[element];- return feature !== null && !LANDER_RICH_TEXT_FEATURES.includes(feature);+ return (+ feature !== null &&+ !LANDER_RICH_TEXT_FEATURES.includes(feature as LanderRichTextFeature)+ );});expect(missing).toEqual([]);diff --git a/apps/web/ui/partners/groups/design/lander/lander-rich-text-editor.tsx b/apps/web/ui/partners/groups/design/lander/lander-rich-text-editor.tsxindex 04858a524d..d64471652b 100644--- a/apps/web/ui/partners/groups/design/lander/lander-rich-text-editor.tsx+++ b/apps/web/ui/partners/groups/design/lander/lander-rich-text-editor.tsx@@ -1,8 +1,8 @@"use client";+import { LANDER_RICH_TEXT_FEATURES } from "@/ui/partners/lander/lander-markdown";import {RichTextArea,- RichTextFeature,RichTextProvider,RichTextToolbar,useRichTextLength,@@ -10,17 +10,6 @@ import {import { cn, nFormatter } from "@dub/utils";import { useEffect, useRef } from "react";-export const LANDER_RICH_TEXT_FEATURES: RichTextFeature[] = [- "headings",- "bold",- "italic",- "strike",- "links",- "lists",- "tables",- "quote",-];-export function LanderRichTextEditor({id,value,@@ -42,7 +31,7 @@ export function LanderRichTextEditor({}) {return (<RichTextProvider- features={LANDER_RICH_TEXT_FEATURES}+ features={[...LANDER_RICH_TEXT_FEATURES]}markdownstyle="relaxed"placeholder={placeholder}diff --git a/apps/web/ui/partners/lander/blocks/block-markdown.tsx b/apps/web/ui/partners/lander/blocks/block-markdown.tsxindex c20da3d6b5..9b7d6a96cf 100644--- a/apps/web/ui/partners/lander/blocks/block-markdown.tsx+++ b/apps/web/ui/partners/lander/blocks/block-markdown.tsx@@ -1,36 +1,9 @@+import { LANDER_MARKDOWN_ALLOWED_ELEMENTS } from "@/ui/partners/lander/lander-markdown";import { cn } from "@dub/utils";import Markdown from "react-markdown";import remarkGfm from "remark-gfm";-export const LANDER_MARKDOWN_ALLOWED_ELEMENTS = [- "p",- "br",- "strong",- "em",- "del",- "a",- "img",- "hr",- "ul",- "ol",- "li",- "input",- "blockquote",- "pre",- "code",- "table",- "thead",- "tbody",- "tr",- "th",- "td",- "h1",- "h2",- "h3",- "h4",- "h5",- "h6",-];+export { LANDER_MARKDOWN_ALLOWED_ELEMENTS };export function BlockMarkdown({className,diff --git a/apps/web/ui/partners/lander/lander-markdown.ts b/apps/web/ui/partners/lander/lander-markdown.tsnew file mode 100644index 0000000000..a23c106892--- /dev/null+++ b/apps/web/ui/partners/lander/lander-markdown.ts@@ -0,0 +1,40 @@+export const LANDER_RICH_TEXT_FEATURES = [+ "headings",+ "bold",+ "italic",+ "strike",+ "links",+ "lists",+ "tables",+ "quote",+] as const;++export const LANDER_MARKDOWN_ALLOWED_ELEMENTS = [+ "p",+ "br",+ "strong",+ "em",+ "del",+ "a",+ "img",+ "hr",+ "ul",+ "ol",+ "li",+ "input",+ "blockquote",+ "pre",+ "code",+ "table",+ "thead",+ "tbody",+ "tr",+ "th",+ "td",+ "h1",+ "h2",+ "h3",+ "h4",+ "h5",+ "h6",+] as const;