Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: fix renderer props
Stevenf563b58a85c5
diff --git a/web/src/components/MemoContent/Blockquote.tsx b/web/src/components/MemoContent/Blockquote.tsxindex 7d5065c02..baf22a083 100644--- a/web/src/components/MemoContent/Blockquote.tsx+++ b/web/src/components/MemoContent/Blockquote.tsx@@ -1,7 +1,8 @@import { Node } from "@/types/proto/api/v2/markdown_service";import Renderer from "./Renderer";+import { BaseProps } from "./types";-interface Props {+interface Props extends BaseProps {children: Node[];}@@ -9,7 +10,7 @@ const Blockquote: React.FC<Props> = ({ children }: Props) => {return (<blockquote>{children.map((child, index) => (- <Renderer key={`${child.type}-${index}`} node={child} />+ <Renderer key={`${child.type}-${index}`} index={String(index)} node={child} />))}</blockquote>);diff --git a/web/src/components/MemoContent/Bold.tsx b/web/src/components/MemoContent/Bold.tsxindex 3919f0f7a..5c197e4a9 100644--- a/web/src/components/MemoContent/Bold.tsx+++ b/web/src/components/MemoContent/Bold.tsx@@ -10,7 +10,7 @@ const Bold: React.FC<Props> = ({ children }: Props) => {return (<strong>{children.map((child, index) => (- <Renderer key={`${child.type}-${index}`} node={child} />+ <Renderer key={`${child.type}-${index}`} index={String(index)} node={child} />))}</strong>);diff --git a/web/src/components/MemoContent/CodeBlock.tsx b/web/src/components/MemoContent/CodeBlock.tsxindex cb7347644..16f8fd930 100644--- a/web/src/components/MemoContent/CodeBlock.tsx+++ b/web/src/components/MemoContent/CodeBlock.tsx@@ -4,8 +4,9 @@ import copy from "copy-to-clipboard";import hljs from "highlight.js";import toast from "react-hot-toast";import Icon from "../Icon";+import { BaseProps } from "./types";-interface Props {+interface Props extends BaseProps {language: string;content: string;}diff --git a/web/src/components/MemoContent/Heading.tsx b/web/src/components/MemoContent/Heading.tsxindex a23738243..2d50a35a4 100644--- a/web/src/components/MemoContent/Heading.tsx+++ b/web/src/components/MemoContent/Heading.tsx@@ -1,7 +1,8 @@import { Node } from "@/types/proto/api/v2/markdown_service";import Renderer from "./Renderer";+import { BaseProps } from "./types";-interface Props {+interface Props extends BaseProps {level: number;children: Node[];}@@ -24,7 +25,7 @@ const Heading: React.FC<Props> = ({ level, children }: Props) => {return (<Head className={className}>{children.map((child, index) => (- <Renderer key={`${child.type}-${index}`} node={child} />+ <Renderer key={`${child.type}-${index}`} index={String(index)} node={child} />))}</Head>);diff --git a/web/src/components/MemoContent/HorizontalRule.tsx b/web/src/components/MemoContent/HorizontalRule.tsxindex 908d049fa..0f81855e3 100644--- a/web/src/components/MemoContent/HorizontalRule.tsx+++ b/web/src/components/MemoContent/HorizontalRule.tsx@@ -1,4 +1,6 @@-interface Props {+import { BaseProps } from "./types";++interface Props extends BaseProps {symbol: string;}diff --git a/web/src/components/MemoContent/LineBreak.tsx b/web/src/components/MemoContent/LineBreak.tsxindex 31d1deae6..2d5db5547 100644--- a/web/src/components/MemoContent/LineBreak.tsx+++ b/web/src/components/MemoContent/LineBreak.tsx@@ -1,4 +1,6 @@-interface Props {}+import { BaseProps } from "./types";++interface Props extends BaseProps {}const LineBreak: React.FC<Props> = () => {return <br />;diff --git a/web/src/components/MemoContent/OrderedList.tsx b/web/src/components/MemoContent/OrderedList.tsxindex fc22c0611..d6484224f 100644--- a/web/src/components/MemoContent/OrderedList.tsx+++ b/web/src/components/MemoContent/OrderedList.tsx@@ -1,7 +1,8 @@import { Node } from "@/types/proto/api/v2/markdown_service";import Renderer from "./Renderer";+import { BaseProps } from "./types";-interface Props {+interface Props extends BaseProps {number: string;children: Node[];}@@ -15,7 +16,7 @@ const OrderedList: React.FC<Props> = ({ number, children }: Props) => {</div><div>{children.map((child, index) => (- <Renderer key={`${child.type}-${index}`} node={child} />+ <Renderer key={`${child.type}-${index}`} index={String(index)} node={child} />))}</div></li>diff --git a/web/src/components/MemoContent/Paragraph.tsx b/web/src/components/MemoContent/Paragraph.tsxindex bda04b792..5b5966eab 100644--- a/web/src/components/MemoContent/Paragraph.tsx+++ b/web/src/components/MemoContent/Paragraph.tsx@@ -1,7 +1,8 @@import { Node } from "@/types/proto/api/v2/markdown_service";import Renderer from "./Renderer";+import { BaseProps } from "./types";-interface Props {+interface Props extends BaseProps {children: Node[];}@@ -9,7 +10,7 @@ const Paragraph: React.FC<Props> = ({ children }: Props) => {return (<p>{children.map((child, index) => (- <Renderer key={`${child.type}-${index}`} node={child} />+ <Renderer key={`${child.type}-${index}`} index={String(index)} node={child} />))}</p>);diff --git a/web/src/components/MemoContent/Renderer.tsx b/web/src/components/MemoContent/Renderer.tsxindex b83570268..c2b7677a3 100644--- a/web/src/components/MemoContent/Renderer.tsx+++ b/web/src/components/MemoContent/Renderer.tsx@@ -51,19 +51,19 @@ interface Props {const Renderer: React.FC<Props> = ({ index, node }: Props) => {switch (node.type) {case NodeType.LINE_BREAK:- return <LineBreak />;+ return <LineBreak index={index} />;case NodeType.PARAGRAPH:- return <Paragraph {...(node.paragraphNode as ParagraphNode)} />;+ return <Paragraph index={index} {...(node.paragraphNode as ParagraphNode)} />;case NodeType.CODE_BLOCK:- return <CodeBlock {...(node.codeBlockNode as CodeBlockNode)} />;+ return <CodeBlock index={index} {...(node.codeBlockNode as CodeBlockNode)} />;case NodeType.HEADING:- return <Heading {...(node.headingNode as HeadingNode)} />;+ return <Heading index={index} {...(node.headingNode as HeadingNode)} />;case NodeType.HORIZONTAL_RULE:- return <HorizontalRule {...(node.horizontalRuleNode as HorizontalRuleNode)} />;+ return <HorizontalRule index={index} {...(node.horizontalRuleNode as HorizontalRuleNode)} />;case NodeType.BLOCKQUOTE:- return <Blockquote {...(node.blockquoteNode as BlockquoteNode)} />;+ return <Blockquote index={index} {...(node.blockquoteNode as BlockquoteNode)} />;case NodeType.ORDERED_LIST:- return <OrderedList {...(node.orderedListNode as OrderedListNode)} />;+ return <OrderedList index={index} {...(node.orderedListNode as OrderedListNode)} />;case NodeType.UNORDERED_LIST:return <UnorderedList {...(node.unorderedListNode as UnorderedListNode)} />;case NodeType.TASK_LIST:diff --git a/web/src/components/MemoContent/UnorderedList.tsx b/web/src/components/MemoContent/UnorderedList.tsxindex e26d2e3e6..803582edc 100644--- a/web/src/components/MemoContent/UnorderedList.tsx+++ b/web/src/components/MemoContent/UnorderedList.tsx@@ -15,7 +15,7 @@ const UnorderedList: React.FC<Props> = ({ children }: Props) => {</div><div>{children.map((child, index) => (- <Renderer key={`${child.type}-${index}`} node={child} />+ <Renderer key={`${child.type}-${index}`} index={String(index)} node={child} />))}</div></li>diff --git a/web/src/components/MemoContent/types/index.ts b/web/src/components/MemoContent/types/index.tsindex 2edd280c7..0103e4f65 100644--- a/web/src/components/MemoContent/types/index.ts+++ b/web/src/components/MemoContent/types/index.ts@@ -1 +1,6 @@export * from "./context";++export interface BaseProps {+ index: string;+ className?: string;+}