Skip to content

Commit 2d459f4

Browse files
committed
fix: remove redundant ViewMarkdown component, fix clipboard error handling
- Remove ViewMarkdown component and its usage in Feedback (covered by CopyPage popover's "View Page as Markdown" link) - Add .catch() to clipboard writeText so users see "Copy failed" instead of nothing on error - Simplify chevron transform logic in toggle handler - Remove redundant border: none reset in .copy-page-panel (immediately overridden by @apply border)
1 parent f5391a8 commit 2d459f4

File tree

4 files changed

+12
-28
lines changed

4 files changed

+12
-28
lines changed

_components/Feedback.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import EditThisPage from "./EditThisPage.tsx";
2-
import ViewMarkdown from "./ViewMarkdown.tsx";
32

43
export default function Feedback({ file }: { file: string | undefined }) {
54
if (!file) {
@@ -71,7 +70,6 @@ export default function Feedback({ file }: { file: string | undefined }) {
7170
</svg>
7271
</label>
7372
{!file.includes("[") && <EditThisPage file={file} />}
74-
{!file.includes("[") && <ViewMarkdown file={file} />}
7573
</div>
7674
<div
7775
id="feedback-more"

_components/ViewMarkdown.tsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

js/copy-page.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ document.querySelectorAll<HTMLButtonElement>(".copy-page-main-btn").forEach(
1111
label.textContent = original;
1212
}, 2000);
1313
}
14+
}).catch(() => {
15+
const label = btn.querySelector<HTMLElement>(".copy-page-main-label");
16+
if (label) {
17+
const original = label.textContent;
18+
label.textContent = "Copy failed";
19+
setTimeout(() => {
20+
label.textContent = original;
21+
}, 2000);
22+
}
1423
});
1524
});
1625
},
@@ -30,8 +39,8 @@ panel?.addEventListener("toggle", (event) => {
3039
const rect = toggleBtn.getBoundingClientRect();
3140
panel.style.top = `${rect.bottom + 4}px`;
3241
panel.style.right = `${window.innerWidth - rect.right}px`;
33-
if (chevron) chevron.style.transform = "rotate(180deg)";
34-
} else {
35-
if (chevron) chevron.style.transform = "";
42+
}
43+
if (chevron) {
44+
chevron.style.transform = e.newState === "open" ? "rotate(180deg)" : "";
3645
}
3746
});

style.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,8 +1231,6 @@
12311231
inset: unset;
12321232
margin: 0;
12331233
padding: 0;
1234-
border: none;
1235-
/* Styled via Tailwind */
12361234
@apply w-72 rounded-md overflow-hidden bg-white dark:bg-gray-900 border
12371235
border-foreground-tertiary shadow-lg;
12381236
}

0 commit comments

Comments
 (0)