Revert "Fix markdown editor escaped list markers"

This reverts commit fbcd80948e.
This commit is contained in:
Dotta
2026-03-07 10:09:04 -06:00
parent f85f2fbcc2
commit a4d0901e89
4 changed files with 8 additions and 83 deletions

View File

@@ -4,7 +4,6 @@ import remarkGfm from "remark-gfm";
import { parseProjectMentionHref } from "@paperclipai/shared";
import { cn } from "../lib/utils";
import { useTheme } from "../context/ThemeContext";
import { normalizeMarkdownArtifacts } from "../lib/markdown";
interface MarkdownBodyProps {
children: string;
@@ -115,7 +114,6 @@ function MermaidDiagramBlock({ source, darkMode }: { source: string; darkMode: b
export function MarkdownBody({ children, className }: MarkdownBodyProps) {
const { theme } = useTheme();
const normalizedMarkdown = normalizeMarkdownArtifacts(children);
return (
<div
className={cn(
@@ -156,7 +154,7 @@ export function MarkdownBody({ children, className }: MarkdownBodyProps) {
},
}}
>
{normalizedMarkdown}
{children}
</Markdown>
</div>
);

View File

@@ -29,7 +29,6 @@ import {
} from "@mdxeditor/editor";
import { buildProjectMentionHref, parseProjectMentionHref } from "@paperclipai/shared";
import { cn } from "../lib/utils";
import { normalizeMarkdownArtifacts } from "../lib/markdown";
/* ---- Mention types ---- */
@@ -204,7 +203,7 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
}: MarkdownEditorProps, forwardedRef) {
const containerRef = useRef<HTMLDivElement>(null);
const ref = useRef<MDXEditorMethods>(null);
const latestValueRef = useRef(normalizeMarkdownArtifacts(value));
const latestValueRef = useRef(value);
const [uploadError, setUploadError] = useState<string | null>(null);
const [isDragOver, setIsDragOver] = useState(false);
const dragDepthRef = useRef(0);
@@ -282,10 +281,9 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
}, [hasImageUpload]);
useEffect(() => {
const normalizedValue = normalizeMarkdownArtifacts(value);
if (normalizedValue !== latestValueRef.current) {
ref.current?.setMarkdown(normalizedValue);
latestValueRef.current = normalizedValue;
if (value !== latestValueRef.current) {
ref.current?.setMarkdown(value);
latestValueRef.current = value;
}
}, [value]);
@@ -556,15 +554,11 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
>
<MDXEditor
ref={ref}
markdown={normalizeMarkdownArtifacts(value)}
markdown={value}
placeholder={placeholder}
onChange={(next) => {
const normalizedNext = normalizeMarkdownArtifacts(next);
latestValueRef.current = normalizedNext;
if (normalizedNext !== next) {
ref.current?.setMarkdown(normalizedNext);
}
onChange(normalizedNext);
latestValueRef.current = next;
onChange(next);
}}
onBlur={() => onBlur?.()}
className={cn("paperclip-mdxeditor", !bordered && "paperclip-mdxeditor--borderless")}