mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-21 16:27:18 +02:00
PAP-2118 address greptile markdown followups
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
879fde73f6
commit
d1a388a3f3
4 files changed
+28
-1
No files matched your search
@@ -207,6 +207,23 @@ describe("InlineEditor", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("marks multiline preview textboxes as multiline", () => {
|
||||
const onSave = vi.fn().mockResolvedValue(undefined);
|
||||
const root = createRoot(container);
|
||||
|
||||
act(() => {
|
||||
root.render(<InlineEditor value="Hello world" multiline onSave={onSave} />);
|
||||
});
|
||||
|
||||
const preview = container.querySelector<HTMLElement>('[role="textbox"]');
|
||||
expect(preview).not.toBeNull();
|
||||
expect(preview?.getAttribute("aria-multiline")).toBe("true");
|
||||
|
||||
act(() => {
|
||||
root.unmount();
|
||||
});
|
||||
});
|
||||
|
||||
it("syncs a new multiline value while focused when the user has not edited locally", () => {
|
||||
const onSave = vi.fn().mockResolvedValue(undefined);
|
||||
const root = createRoot(container);
|
||||
|
||||
@@ -238,6 +238,7 @@ export function InlineEditor({
|
||||
|
||||
if (!showEditor) {
|
||||
const enterEditMode = () => {
|
||||
if (multilineEditing) return;
|
||||
justEnteredEditRef.current = true;
|
||||
setMultilineEditing(true);
|
||||
};
|
||||
@@ -254,6 +255,7 @@ export function InlineEditor({
|
||||
}}
|
||||
onDragEnter={() => enterEditMode()}
|
||||
role="textbox"
|
||||
aria-multiline="true"
|
||||
aria-label={placeholder}
|
||||
>
|
||||
<MarkdownBody className={cn("paperclip-edit-in-place-content", className)}>
|
||||
|
||||
@@ -187,6 +187,14 @@ describe("MarkdownBody", () => {
|
||||
expect(html).toContain("text-green-600");
|
||||
});
|
||||
|
||||
it("does not auto-link non-issue internal route paths", () => {
|
||||
const html = renderMarkdown("Use /issues/new for the creation form and /api/issues for data.");
|
||||
|
||||
expect(html).toContain("Use /issues/new for the creation form and /api/issues for data.");
|
||||
expect(html).not.toContain('href="/issues/new"');
|
||||
expect(html).not.toContain('data-mention-kind="issue"');
|
||||
});
|
||||
|
||||
it("rewrites issue scheme links to internal issue links", () => {
|
||||
const html = renderMarkdown("See issue://PAP-1310 and issue://:PAP-1311.", [
|
||||
{ identifier: "PAP-1310", status: "done" },
|
||||
|
||||
@@ -7,7 +7,7 @@ type MarkdownNode = {
|
||||
|
||||
const BARE_ISSUE_IDENTIFIER_RE = /^[A-Z][A-Z0-9]+-\d+$/i;
|
||||
const ISSUE_SCHEME_RE = /^issue:\/\/:?([^?#\s]+)(?:[?#].*)?$/i;
|
||||
const ISSUE_REFERENCE_TOKEN_RE = /issue:\/\/:?[^\s<>()]+|https?:\/\/[^\s<>()]+|\/[^\s<>()]+|\b[A-Z][A-Z0-9]+-\d+\b/gi;
|
||||
const ISSUE_REFERENCE_TOKEN_RE = /issue:\/\/:?[^\s<>()]+|https?:\/\/[^\s<>()]+|\/(?:[^\s<>()/]+\/)*issues\/[A-Z][A-Z0-9]+-\d+\b|\b[A-Z][A-Z0-9]+-\d+\b/gi;
|
||||
|
||||
export function parseIssuePathIdFromPath(pathOrUrl: string | null | undefined): string | null {
|
||||
if (!pathOrUrl) return null;
|
||||
|
||||
Reference in new issue
Block a user